From 41876fd5e296a967a5d2ad08e54a9f69651e083c Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 28 May 2023 21:41:53 +0100 Subject: Fix timing when jumping up in some cases --- src/Game/Entities/Tracker.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Game/Entities/Tracker.hs b/src/Game/Entities/Tracker.hs index 80b8574..9baac80 100644 --- a/src/Game/Entities/Tracker.hs +++ b/src/Game/Entities/Tracker.hs @@ -16,7 +16,12 @@ updateTracker updateRunner facingPlayerLower isBlocked ent = do e <- updateRunner ent facing <- facingPlayerLower e pure $ - if facing && e.gravity == gravityOff && not (isBlocked (ent.x + 8) (ent.y - 1)) && isBlocked (ent.x + 8) ent.y + if facing + && e.gravity == gravityOff + && not (isBlocked (isBlockedX e) (e.y - 1)) + && not (isBlocked (e.x + 8) (e.y - 1)) + && isBlocked (isBlockedX e) e.y + && isBlocked (e.x + 8) e.y then e { gravity = gravityUp, @@ -24,3 +29,6 @@ updateTracker updateRunner facingPlayerLower isBlocked ent = do actions = [ActionAddEffect ent.x (ent.y + 8) "dust"] } else e + where + isBlockedX :: Entity -> Int + isBlockedX e = if e.dir == DirLeft then e.x + 16 else e.x - 1 -- cgit v1.2.3