Blocage du joueur sur les murs
This commit is contained in:
parent
311f369d66
commit
7a99ed4e4b
1 changed files with 9 additions and 2 deletions
|
@ -9,8 +9,15 @@ keyDown = keyboard_check(vk_down) or keyboard_check(ord("S"));
|
||||||
deplaceHorizontal = keyRight - keyLeft;
|
deplaceHorizontal = keyRight - keyLeft;
|
||||||
deplaceVertical = keyDown - keyUp;
|
deplaceVertical = keyDown - keyUp;
|
||||||
|
|
||||||
|
if ((deplaceHorizontal > 0 && !place_meeting(x+1, y, oWall))
|
||||||
|
|| (deplaceHorizontal < 0 && !place_meeting(x-1, y, oWall))) {
|
||||||
x += deplaceHorizontal;
|
x += deplaceHorizontal;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((deplaceVertical > 0 && !place_meeting(x, y+1, oWall))
|
||||||
|
|| (deplaceVertical < 0 && !place_meeting(x, y-1, oWall))) {
|
||||||
y += deplaceVertical;
|
y += deplaceVertical;
|
||||||
|
}
|
||||||
|
|
||||||
seDeplace = (deplaceHorizontal != 0 or deplaceVertical != 0);
|
seDeplace = (deplaceHorizontal != 0 or deplaceVertical != 0);
|
||||||
|
|
||||||
|
|
Reference in a new issue