Page 1 of 1

Have a variable increase as a key is held down?

PostPosted: Fri Apr 05, 2013 11:58 pm
by Excal
The solution is painfully obvious, but it doesn't seem to work.



Whenever I test it, the turnRate never goes above 1.1:



Anyone know how the keyboard input works for 'on key down' and can explain how this would be done?

Re: Have a variable increase as a key is held down?

PostPosted: Sat Apr 06, 2013 12:14 am
by Kyatric
Well you don't need the top event "on every tick", but that's not the issue there.

If you reproduce your logic there in a brand new capx : like this one it does work as expected.

So obviously the issue is somewhere else in your code where you probably modify "TurnRate" value after this input.

Without seeing your capx, no way to tell, but this simple test confirms that the logic is working and that you're asking the wrong question/looking in the wrong corner.

Re: Have a variable increase as a key is held down?

PostPosted: Sat Apr 06, 2013 1:10 am
by Excal
I think I figured it out.

turnRate is a local variable, but it wasn't set to Static, so it was being reset constantly.