simple way: multiplier.
Multiplier is a very simple way to enable/disable without using a lot of code. Create another variable, and use it on your scoring. You don't need to use count variable in that manner either. All you need is the timer.
Like this
KeyDown>KeyRight
- Code: Select all
Score+=value*enable;
That sure was simple, eh?
So score is your score variable, the one that your text actor will display. Value is how many points the player scores each time he hits the right key. and enable is a variable that's either 1 or 0. You set it to 1 whenever you want the player to be able to use keydown>keyright.
And on the timer
- Code: Select all
enable=0;
Technically the player can still push right, and get a score, but the points are worth 0.
Of course if you have other actions on key right, and you want to disable them all, then you can still use if (enable>0){};
Same effect.
But the nice thing about the multiplier is you can use it for bonuses. Like if a player gets 10 in a row, points suddenly are worth double.