Hey guys! I am back again with another boolean related inquiry!
So I have a character, and he jumps, he is capable of double jumping. I would like a nice jump sound for either just the first jump, or both jumps. I have not decided this far yet. For now, I am trying to just have it play when he does his initial jump. Here is what I have, it does not play the sound very well, it either plays it a million times, once or twice, or not at all.
if (!Input.check(Key.SPACE) && isJumping)
{
doubleJump = true;
}
if (Input.check(Key.SPACE) && isJumping && !doubleJump)
{
sfxJump = new Sfx(theGameSounds.SND_JUMP_SOUND);
sfxJump.play();
}
if (Input.check(Key.SPACE) && doubleJump && isJumping)
{
ySpeed = -jumpPower;
isJumping=false;
doubleJump=false;
}
Let me know what you guys think! Any help is very much appreciated!