Page 1 of 1

collision sound problem

PostPosted: Thu Sep 21, 2006 10:17 pm
by pixelpoop
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 :?:

PostPosted: Thu Sep 21, 2006 10:39 pm
by Game A Gogo
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.

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

PostPosted: Fri Sep 22, 2006 1:21 am
by pixelpoop
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;