4
0
Fork 0

Blocage du joueur sur les murs

This commit is contained in:
rick 2020-12-05 19:16:11 +01:00
parent 311f369d66
commit 7a99ed4e4b

View file

@ -9,8 +9,15 @@ keyDown = keyboard_check(vk_down) or keyboard_check(ord("S"));
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);