• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to execute a sprite only once

S

Sergioros00

Guest
I'm making a 2D plataformer game, and I want when my character touch the wall, I want to execute a sprite but only once, but the sprite start a loop. Anyone can help me? I'm new on this :c
 

TsukaYuriko

☄️
Forum Staff
Moderator
The term "execute a sprite" doesn't really have any meaning in GameMaker... do you mean playing a sprite's animation only once?

If so, you may be interested in the Animation End event. This event fires when the instance's sprite's animation has finished playing. Check whether the sprite is the one that's only supposed to play once, and if it is, change the sprite back to something else.
 

Rexzqy

Member
if u want to make a object play its animation and then disappear u can do :

if image_index > image_number - 1
{
instance_destroy();
}

if u want what tsuka mentioned then follow what he/she said :D

Edit: btw put that in the step event of the object
 
Top