emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/pacmacs d9ddd5dab4 132/472: Refactor pacmacs--detect-ghost


From: ELPA Syncer
Subject: [nongnu] elpa/pacmacs d9ddd5dab4 132/472: Refactor pacmacs--detect-ghost-collision (#97)
Date: Thu, 6 Jan 2022 21:59:19 -0500 (EST)

branch: elpa/pacmacs
commit d9ddd5dab4948152098c6e2a4dc5e4fba7414698
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>

    Refactor pacmacs--detect-ghost-collision (#97)
---
 pacmacs.el | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/pacmacs.el b/pacmacs.el
index 61eb8c3827..10ad23dbdb 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -330,8 +330,7 @@
   (plist-bind ((row :row)
                (column :column))
       pacmacs-player-state
-    (-when-let (ghost (pacmacs--ghost-at-p row column))
-      (pacmacs--switch-to-death-state))))
+    (pacmacs--ghost-at-p row column)))
 
 (defun pacmacs-play-state-logic ()
   (pacmacs-anim-object-next-frame pacmacs-player-state 
pacmacs-tick-duration-ms)
@@ -341,15 +340,14 @@
     (pacmacs-anim-object-next-frame pill pacmacs-tick-duration-ms))
 
   (pacmacs--recalc-track-board)
-  (pacmacs--detect-ghost-collision)
-  (when (equal pacmacs-game-state 'play)
+  (if (pacmacs--detect-ghost-collision)
+      (pacmacs--switch-to-death-state)
     (pacmacs-step-object pacmacs-player-state)
     (pacmacs--detect-pill-collision)
     (if pacmacs-pills
-        (progn
-          (pacmacs--detect-ghost-collision)
-          (when (equal pacmacs-game-state 'play)
-            (pacmacs--step-ghosts)))
+        (if (pacmacs--detect-ghost-collision)
+            (pacmacs--switch-to-death-state)
+          (pacmacs--step-ghosts))
       (pacmacs--load-next-level)
       (pacmacs--switch-to-prepare-state))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]