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