diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-28 21:41:53 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-28 22:13:18 +0100 |
commit | 41876fd5e296a967a5d2ad08e54a9f69651e083c (patch) | |
tree | 6b66960ce5c88767ca8ae6c42da368a58005f7ad /src/Game | |
parent | f886dc2f03a75b12749ad029134b70c346aea194 (diff) | |
download | space-plat-hs-41876fd5e296a967a5d2ad08e54a9f69651e083c.tar.gz space-plat-hs-41876fd5e296a967a5d2ad08e54a9f69651e083c.zip |
Fix timing when jumping up in some cases
Diffstat (limited to 'src/Game')
-rw-r--r-- | src/Game/Entities/Tracker.hs | 10 |
1 files changed, 9 insertions, 1 deletions
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 |