Sign in to follow this  
Mybowlcut

More slider math

Recommended Posts

Hi. Recently I wrote a thread in this sub-forum about a volume slider here. I've completed that feature of my game successfully, but now I'm doing a similar thing which involves the speed of the computer. I would have taken the formula from the previous slider, but in this case it's different. The slowest speed is 10 seconds or 10000 milliseconds and the fastest speed is 0 (takes the computer 0 seconds to react). I was wondering how I'd go about doing this? Cheers. Edit: This is the basic idea of the slider.

Share this post


Link to post
Share on other sites
The easiest way to calculate value (speed) from slider position is to do linear interpolation:

speed = value_min+( value_max-value_min )*( slider_pos/slider_width )

Share this post


Link to post
Share on other sites
Oh, no I've already got a formula that works for me fine, but I'd like to make it so that if the user slides the slider to the right to value gets smaller, and if they slide it to the left it gets bigger.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this