How to do something on collision, but only once?

Not once ever, only once collision happens.

Here’s what I’m trying to do: In my game I have those harmless little piggies that player can step on and they should make this “oink” sound once collision with player happens. Of course when I do that in “Player is colliding with pig” event, the effect won’t be nice. Any help on that?

Maybe something like:

If player collide with pig and pig.variable(collide)=0: ........pig.variable(collide)=1 sound "oink.wav" If player not collide with pig and pig.variable(collide)=1: .......pig.variable(collide)=0

If the pig collide, then doesn’t collide and collide again, will play the sound.

Just give each pig a variable hascollided set to 0. Set it to 1 when the collision has happened first time. Make hascollided = 0 a condition of whatever you want to do with them.