kureoni
Member
thats the code
they work separately but they dont work together
any ideas?
its a topdown game
the character should walk in any direction facing the mouse position
example: if the player is walking upwards and the mouse is downwards, he should walk up facing down.
HELP
GML:
//for y axis
if(y > mouse_y){
sprite_index = spr_player_back
}
if(y < mouse_y){
sprite_index = spr_player_front
}
if(y != yprevious && y > mouse_y){
sprite_index = spr_player_walkback
}
if(y != yprevious && y < mouse_y){
sprite_index = spr_player_walkfront
}
if(y < mouse_y && x != xprevious){
sprite_index = spr_player_walkfront
}
if(y > mouse_y && x != xprevious){
sprite_index = spr_player_walkback
}
//for x axis
if(x < mouse_x && x = xprevious){
image_xscale = 3
sprite_index = spr_player
}
if(x > mouse_x && x = xprevious){
image_xscale = -3
sprite_index = spr_player
}
if(x < mouse_x && x != xprevious){
image_xscale = 3
sprite_index = spr_player_walk
}
if(x > mouse_x && x != xprevious){
image_xscale = -3
sprite_index = spr_player_walk
}
any ideas?
its a topdown game
the character should walk in any direction facing the mouse position
example: if the player is walking upwards and the mouse is downwards, he should walk up facing down.
HELP