collision sound problem

Non-platform specific questions.

collision sound problem

Postby pixelpoop » Thu Sep 21, 2006 10:17 pm

Hello all,

I have a problem with sounds repeating during a collision.

I have a ball fall and collide with a ramp. the ramp doesn't react. The ball hits and with almost no bounce slides off of the ramp. I have a sound for when the ball collides with the ramp. The problem is, as the ball slides off of the ramp it continues to repeat the sound.
The "repeat this event while actor is colliding:" box is set to no.
I can't use a timer to turn the sound back on because the ball can hit the ramp at any place, thus the time of the slide can always be different.
And I have little to no programing skills.
any advice :?:
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby Game A Gogo » Thu Sep 21, 2006 10:39 pm

ah yes, that big bug of colision, it maded dificult everyone game programing "perfect", well as for now, the only thing would be that when he colides to the thing
Code: Select all
if(coli==0)playsound("blabla");
coli=1;

and when the action that is supose to determine that the ball has finished touching (whitout using the colision finish)
Code: Select all
coli=0;

also, click variable(in the script editor) click new, and then type the name col.i in the name feild, and click add, dont worry about the other option thing.

and maube it should work.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

i'm going to name my first child Game a Gogo

Postby pixelpoop » Fri Sep 22, 2006 1:21 am

Thanks, I got it working. here it is incase others need it.

on actor that is colliding:
event: collision/physical response(controls collision physics)
event: collision/scripteditor(plays sound if variable is 0)
Code: Select all
if(coli==0)PlaySound2("data/Bubble5.wav", 1.000000, 1, 0.000000);
coli=1;
 

event: drawactor/scripteditor(sets gravity)
Code: Select all
yvelocity = yvelocity + 1;

event: drawactor/scripteditor(turns sound variable on if the actor has moved 10 pixels or more since its last position)
Code: Select all
if((y-yprevious)>10)
coli=0;
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest