Sound Effects Timer

Non-platform specific questions.

Sound Effects Timer

Postby Super Pieman » Wed Nov 07, 2007 4:31 pm

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.
Current Projects:
*Lonely (2%)
**LinkSys (1%)

*To be made in GE, then ported to DS.
**To be made for the DS.
User avatar
Super Pieman
 
Posts: 57
Joined: Sat Nov 03, 2007 3:27 pm
Location: Manotick (Ontario, Canada)
Score: 2 Give a positive score

Re: Sound Effects Timer

Postby Kalladdolf » Wed Nov 07, 2007 4:40 pm

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;
}
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron