W
White_heart_of_Blood
Guest
I have this script and it's not working PLs help me
The script is in my player movement script witch is in my players
step event.
sc_animation:
sc_movement:
Thats all the code that envoles the movement/animation
pls help me I be a noob
The script is in my player movement script witch is in my players
step event.
sc_animation:
Code:
// Left or Right
if (xprevious < x) {
image_speed = 1;
sprite_index = sp_player_right;
} else if (xprevious > x) {
image_speed = 1;
sprite_index = sp_player_left;
} else if (xprevious == x) {
image_speed = 0;
image_index = 0;
}
// Up or Down
if (yprevious < y) {
image_speed = 1;
sprite_index = sp_player_down;
} else if (yprevious > y) {
image_speed = 1;
sprite_index = sp_player_up;
} else if (yprevious == y) {
image_speed = 0;
image_index = 0;
}
Code:
sc_input();
// Moving Right
if (r_key) {
hspd = spd;
direc = 0;
}
// Moving Left
if (l_key) {
hspd = -spd;
direc = 1;
}
// Moving down
if (d_key) {
vspd = spd;
direc = 3;
}
// Moving up
if (u_key) {
vspd = -spd;
direc = 4;
}
// Check for !moving right or left
if ((!r_key && !l_key) or (r_key && l_key)) {
hspd = 0;
}
// Check for !moving up or down
if ((!d_key && !u_key) or (d_key && u_key)) {
vspd = 0;
}
// Horizontal Colliosins
if (place_meeting(x+hspd, y, ob_soild)) {
while (!place_meeting(x+sign(hspd), y, ob_soild)) {
x += sign(hspd);
}
hspd = 0;
}
// Move Horizontal
x += hspd;
// Vertical Colliosins
if (place_meeting(x, y+vspd, ob_soild)) {
while (!place_meeting(x, y+sign(vspd), ob_soild)) {
y += sign(vspd);
}
vspd = 0;
}
// Move Vertical
y += vspd;
sc_player_animation();
pls help me I be a noob
Last edited by a moderator: