A
Alex03
Guest
I am having problems when I move horizontally and vertically. Example: If I press the right key and the down key, the animation switches correctly; the problem is: the animation only shows the first 2 animations on loop. So if i'm trying to walk down + right, it looks like i'm limping that way. How do I fix this?
Here is the code-
///scr_move
scr_keys();
// Move Right
if (rightkey) {
phy_position_x += spd;
sprite_index = spr_player_right;
image_speed = 1;
}
// Move left
if (leftkey) {
phy_position_x -= spd;
sprite_index = spr_player_left;
image_speed = 1;
}
// Move up
if (upkey) {
phy_position_y -= spd;
sprite_index = spr_player_up;
image_speed = 1;
}
// Move down
if (downkey) {
phy_position_y += spd;
sprite_index = spr_player_down;
image_speed = 1;
}
// Idle
if (!rightkey && !leftkey && !upkey && !downkey) {
image_index = 0;
}
// Vertical and Horizontal Movement
if (rightkey || leftkey) && (downkey || upkey) {
spd = 3;
}
Here is the code-
///scr_move
scr_keys();
// Move Right
if (rightkey) {
phy_position_x += spd;
sprite_index = spr_player_right;
image_speed = 1;
}
// Move left
if (leftkey) {
phy_position_x -= spd;
sprite_index = spr_player_left;
image_speed = 1;
}
// Move up
if (upkey) {
phy_position_y -= spd;
sprite_index = spr_player_up;
image_speed = 1;
}
// Move down
if (downkey) {
phy_position_y += spd;
sprite_index = spr_player_down;
image_speed = 1;
}
// Idle
if (!rightkey && !leftkey && !upkey && !downkey) {
image_index = 0;
}
// Vertical and Horizontal Movement
if (rightkey || leftkey) && (downkey || upkey) {
spd = 3;
}