Ok...I have scripted the left and right keyboard buttons to play a walking animation for my game character in the obvious directions.
The problem is - when the keys are released I want to goto a different frame (still animation). Seeing as how there is no "On key release" event, how could I accomplish this?
I already knew how to move the sprite with key controls but thats not what I want to do. It will stay in place while the background will scroll accordingly. Instead I need it to go to certain frames for a walking animation while the key is pressed and return to it's initial frame when its not.
Example: Frame 1 is a standing still animation
//Frame 3 walking right animation
on (keyPress("<Right>")) {
tellTarget (player) {
gotoAndPlay(3);
}
}
//Frame 5 walking left animation
on (keyPress("<Left>")) {
tellTarget (player) {
gotoAndPlay(5);
}
}
I need it it to return to frame 1 when the key is not being pressed.
So since there isn't a event of this nature, I'm thinking it may have to be conditional, but I'm not exactly sure.
Any suggestions?
I don't think you understand what I'm trying to say as the background is another sprite.
I will simplfy the problem.
When I press a key I want an animatiuon to start and when I release the key I want the animation to stop. Not the mouse buttons - the keyboard. How can I do this?