Page 1 of 1

Sound Effects Timer

PostPosted: Wed Nov 07, 2007 4:31 pm
by Super Pieman
I have a sound effect that is supposed to only work when the i key is pressed and only once until the character hits the ground. For some reason it always plays when you hit the i key even in the air. Here are my codes.

on collision with the ground.
Code: Select all
in_air=0;


on collision finish of the ground.
Code: Select all
CreateTimer("Jump", 100);

(repeats only once.)

On "Jump" timer.
Code: Select all
in_air=1;


On keydown for jump key.
Code: Select all
if(in_air==1)
{
    PlaySound2("/data/Mario Jump.wav" 0, 0, 1);
}


If anyone can tell me what is wrong please do.

Re: Sound Effects Timer

PostPosted: Wed Nov 07, 2007 4:40 pm
by Kalladdolf
maybe u should have the last code bit like this:
Code: Select all
if(in_air==1)
{
    PlaySound2("/data/Mario Jump.wav" 0, 0, 1)
in_air = 0;
}