L
Lakor
Guest
I'm making my first topview adventure. I have some issues with the sprites when walking. I have four sprites: Standing_Left, Walking_Left (strip), Standing_Right and Walking_Right (strip).
You can move all 4 directions, but I only want to use left & right looking sprites (both standing still and walking).
Horizontally the code works perfect, but vertical walking has some issues. When I walk straight down it only uses the Standing sprites and when moving straight up it automatically goes to Walking_Right (even when starting left).
Help much appreciated!
You can move all 4 directions, but I only want to use left & right looking sprites (both standing still and walking).
Horizontally the code works perfect, but vertical walking has some issues. When I walk straight down it only uses the Standing sprites and when moving straight up it automatically goes to Walking_Right (even when starting left).
Help much appreciated!
Code:
face = round(dir/180);
switch(face) {
case 0: if (xaxis == 0) && (yaxis == 0) {
sprite_index = spr_standing_right; }
else { sprite_index = spr_running_right;}
break;
case 1: if (xaxis == 0) && (yaxis == 0) {
sprite_index = spr_standing_left; }
else { sprite_index = spr_running_left;}
break;
Last edited by a moderator: