From f46c8e34cedab747e1f41e1e7711df4c5f5661cb Mon Sep 17 00:00:00 2001 From: rick Date: Sat, 5 Dec 2020 23:04:52 +0100 Subject: [PATCH] =?UTF-8?q?Suppression=20bug=20coincage=20dans=20les=20mur?= =?UTF-8?q?s=20quand=20pouss=C3=A9=20par=20monstre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- objects/oPlayer/Collision_oMonster.gml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/objects/oPlayer/Collision_oMonster.gml b/objects/oPlayer/Collision_oMonster.gml index fadd6b6..c38fe0d 100644 --- a/objects/oPlayer/Collision_oMonster.gml +++ b/objects/oPlayer/Collision_oMonster.gml @@ -8,12 +8,13 @@ if (pdv <= 0) { } // pushback -if (other.x > x) { - x -= 10; -} else if (other.x < x) { - x += 10; -} else if (other.y > y) { - y -= 10; -} else if (other.y < y) { - y += 10; +knockback = 10; +if (other.x > x && !place_meeting(x-knockback-1, y, oWall)) { + x -= knockback; +} else if (other.x < x && !place_meeting(x+knockback+1, y, oWall)) { + x += knockback; +} else if (other.y > y && !place_meeting(x, y-knockback-1, oWall)) { + y -= knockback; +} else if (other.y < y && !place_meeting(x, y+knockback+1, oWall)) { + y += knockback; } \ No newline at end of file