• 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!

GML How to make gamemaker randomly select a sprite over time

F

footlegchicken

Guest
lets say if I had: spr_chicken1, spr_chicken2 and spr_chicken3 and I want them to change randomly after 4 seconds, how do I do that?
like spr_chicken1 turns into spr_chicken2 and maybe back into spr_chicken1 then spr_chicken3 just make it go randomly
 

TheouAegis

Member
Or if you don't to make sure the sprite changes every time (obscene's suggestion has the potential for a sprite to remain the same for more than 4 second):
Code:
count+=1;
if count == 4*room_speed {    //this is how you check for frame-based seconds if room_speed might not be 60
    do var n = choose(sprites, names, here)
    until sprite_index != n;
    sprite_index = n;
}
 
Top