I've started learning to build games in Flash and have a question regarding onClipEvent (enterFrame)
I have a test character whose animation is controlled by arrow-key presses and currently his mc code goes like this..
onClipEvent (enterFrame){
if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
gotoAndPlay ("leap");
}
}
It all works fine, as you can see
here, but you'll notice that he only jumps when you
release your finger from the UP key. I'd like him to jump immediately the key is pressed, and I'm sure the problem is this:
as long as your finger is on the UP key, that line of code is continuously being run, i.e. gotoAndPlay ("leap"); Therefore, he's stuck on the frame labelled 'leap'. When you release your finger however, he jumps away.
Could anyone please tell me how I'd run that piece of code only once? I have tried using a counter variable, but I'm not too good at ActionScript (trying to remedy that) and I'm sure I'm doing everything wrong.
Cheers