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

animations while moving

kureoni

Member
i already did all the animations for the player for a topdown game, how can i make gmstudio run the walking animation when the obj_player is moving, and run a different animation when he is stopped??
 

DPMlofty

Member
You use (sprite_index) to change sprites in game.
you can do like this

if(x = xprevious){
sprite_index = spr_idle
}

if(x != xprevious){
sprite_index = spr_walk
}
 

kureoni

Member
You use (sprite_index) to change sprites in game.
you can do like this

if(x = xprevious){
sprite_index = spr_idle
}

if(x != xprevious){
sprite_index = spr_walk
}
it works!
the only problem is that it has a bug
it keeps teleporting when i walk another way, making the sprite get stuck in the walls or in the enemys, when it touches the enemy it gets crazy etc
 

DPMlofty

Member
it works!
the only problem is that it has a bug
it keeps teleporting when i walk another way, making the sprite get stuck in the walls or in the enemys, when it touches the enemy it gets crazy etc
make sure both sprites have the same origin point
 
Top