I have made basic movement for my 4Champ, but I have a problem with the Jump SFX.
The jump button is the Space bar. In the below code, I said when the guy is touching the floor and the space bar is pressed, the Sound plays. He only touches the floor and registers the space bar pressed for a very brief period (Seeing as he is jumping away from the floor), however the sound sometimes plays twice in a row very quickly. How do I fix this?
Here's the code:
if (FlxG.keys.pressed("SPACE"))
{
if (touching == FlxObject.FLOOR)
{
FlxG.play(sndJump, 0.5, false);
}
}