Jump to content
  • Advertisement
Sign in to follow this  
Mybowlcut

More slider math

This topic is 4056 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!