I'm having a bit of trouble wrapping my head around something.
I'm struggling to control variables, here's an example:
Say if I have a number variable called speed, it starts at 0. If the player presses up, every tick add 1 to 'speed' - if player releases up, every tick subtract 1 from speed.
First question is how do I 'clamp' the variable so that it never extends past a max or minimum speed?
Second question is how would I use this 'speed' variable to affect something else which uses a different numerical range, let's say volume, at 0 speed, volume should be 0db at 50 speed volume should be 0.5 etc
I know how to set 'volume' to 'speed' - but I don't want the volume to have a range of 0 - 100, I'd like it to be 0 - 1 - or even if it was something wild like timescale, I'd like timescale to be affected by 'speed' but with a range of 0 - 1.5 instead of 0 - 100.
Am I explaining this okay? I'm pretty confused over the matter haha.