Hello!
I am trying to make a platform game in flash and want the character to play a sound everytime i hit the attackbutton, but only once.
I´ve tried everything i can come up with, but the sound just keeps looping over and over.
What to do?
Code for the attack:
if (Key.isDown(_root.ATTACKKEY)) {
//if the player is pushing the attack key
if (_root.mcPLAYER.GROUNDED == true && _root.ATTACK == 1) {
//if the player is grounded
if (_root.mcPLAYER.DIRECTION == "R") {
//if the player is facing right
_root.mcPLAYER.gotoAndPlay(13);
//show the player attack facing right frame
} else {
//if the player is facing left
_root.mcPLAYER.gotoAndPlay(14);
//show the player attack facing left frame
}
and in the mcPLAYER frame 13 and 14, I have placed the sound in the timeline and at the end I also put stop();
However… it keeps repeating…
Can anyone help me? Thanks for your time