• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

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