33 lines
No EOL
972 B
Text
33 lines
No EOL
972 B
Text
keyLeft = keyboard_check(vk_left) or keyboard_check(ord("Q"));
|
|
keyRight = keyboard_check(vk_right) or keyboard_check(ord("D"));
|
|
keyUp = keyboard_check(vk_up) or keyboard_check(ord("Z"));
|
|
keyDown = keyboard_check(vk_down) or keyboard_check(ord("S"));
|
|
|
|
|
|
// Déplacement du joueur
|
|
|
|
deplaceHorizontal = keyRight - keyLeft;
|
|
deplaceVertical = keyDown - keyUp;
|
|
|
|
if ((deplaceHorizontal > 0 && !place_meeting(x+1, y, oWall))
|
|
|| (deplaceHorizontal < 0 && !place_meeting(x-1, y, oWall))) {
|
|
x += deplaceHorizontal;
|
|
}
|
|
|
|
if ((deplaceVertical > 0 && !place_meeting(x, y+1, oWall))
|
|
|| (deplaceVertical < 0 && !place_meeting(x, y-1, oWall))) {
|
|
y += deplaceVertical;
|
|
}
|
|
|
|
seDeplace = (deplaceHorizontal != 0 or deplaceVertical != 0);
|
|
|
|
// Animation des sprites
|
|
|
|
if (seDeplace) {
|
|
if (deplaceHorizontal = 0) {
|
|
if (deplaceVertical = 1) image_index = 0;
|
|
else image_index = 2;
|
|
}
|
|
else if (deplaceHorizontal = 1) image_index = 1;
|
|
else image_index = 3;
|
|
} |