AS3 Creating arcade-like arrow controls for a game (combination like in Fahrenheit)

The first thing you need are key event listeners for stage. This let’s you detect when people type up, down, etc.

The timing of the sequence is a little trickier. I’m trying to think of the most straight forward approach to that. I guess this would be using setInterval. Basically have an array of your directions and go through that array on each interval iteration until it’s complete or the user messes up at which point you clear the interval to stop it from going any longer. A recent tweening thread here has a similar code sample

So, when ready is pressed, set up key listeners, start interval, and check that when a key is pressed, it matches the currently tracked position in your expected keys array. Then on the next interval, update that tracked position and wait for the next key.

You’ll want to do some checking of whether or not the user clicks the same key twice (which I think would be ok) and decide how other key presses are handled, and if it means losing or not. If a key does result in losing, clear the interval, remove the key listener, and show the opposite of whatever is Victory, etc.

1 Like