[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 4862789072 335/472: Terrify/unterrify ghost withou
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 4862789072 335/472: Terrify/unterrify ghost without losing state |
Date: |
Thu, 6 Jan 2022 21:59:37 -0500 (EST) |
branch: elpa/pacmacs
commit 486278907297e4c8d57275c2aac3ee48caaccdcf
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Terrify/unterrify ghost without losing state
(#171)
---
pacmacs.el | 44 ++++++++++++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 12 deletions(-)
diff --git a/pacmacs.el b/pacmacs.el
index d93ee1a437..205a0932f1 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -438,22 +438,42 @@
(funcall new-constructor row column))
(funcall old-destructor game-object)))
+(defun pacmacs--terrified-ghost-timed-out-p (terrified-ghost)
+ (<= (plist-get terrified-ghost :terrified-timer) 0))
+
+(defun pacmacs--terrify-ghost (ghost)
+ (plist-put ghost :current-animation
+ (pacmacs-load-anim "Terrified-Ghost"))
+ (plist-put ghost :switch-direction-callback
+ #'pacmacs--switch-direction-callback)
+ (plist-put ghost :type 'terrified-ghost)
+ (plist-put ghost :terrified-timer
+ pacmacs--ghost-terrified-time-ms)
+ ghost)
+
+(defun pacmacs--unterrify-ghost (terrified-ghost)
+ (plist-put terrified-ghost :switch-direction-callback
+ (pacmacs--switch-direction-animation-callback "Red-Ghost"))
+ (plist-put terrified-ghost :type 'ghost)
+ (pacmacs--switch-direction terrified-ghost
+ (plist-get terrified-ghost :direction))
+ terrified-ghost)
+
(defun pacmacs--terrify-all-ghosts ()
- (pacmacs--replace-game-objects pacmacs--ghosts
- #'pacmacs--create-terrified-ghost
- #'pacmacs--remove-object)
+ (dolist (ghost pacmacs--ghosts)
+ (add-to-list 'pacmacs--terrified-ghosts
+ (pacmacs--terrify-ghost ghost)))
(setq pacmacs--ghosts nil))
(defun pacmacs--unterrify-timed-out-ghosts ()
- (let ((timed-out-predicate
- (-lambda (terrified-ghost)
- (<= (plist-get terrified-ghost :terrified-timer) 0))))
- (pacmacs--replace-game-objects
- (-filter timed-out-predicate pacmacs--terrified-ghosts)
- #'pacmacs--create-ghost
- #'pacmacs--remove-object)
- (setq pacmacs--terrified-ghosts (-remove timed-out-predicate
- pacmacs--terrified-ghosts))))
+ (dolist (terrified-ghost (-filter #'pacmacs--terrified-ghost-timed-out-p
+ pacmacs--terrified-ghosts))
+ (add-to-list 'pacmacs--ghosts
+ (pacmacs--unterrify-ghost terrified-ghost)))
+
+ (setq pacmacs--terrified-ghosts
+ (-remove #'pacmacs--terrified-ghost-timed-out-p
+ pacmacs--terrified-ghosts)))
(defun pacmacs--detect-pill-collision ()
(plist-bind ((row :row)
- [nongnu] elpa/pacmacs 61b07fd669 252/472: Add some screenshot of the latest version, (continued)
- [nongnu] elpa/pacmacs 61b07fd669 252/472: Add some screenshot of the latest version, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs f1f7f6f407 256/472: Animated big pills (#81), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 69437be130 259/472: Extra points for eating big pills (#81), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4ef8e6cdb4 260/472: Merge branch 'big-pills-81'. Close #81, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 59685e56a4 261/472: Clean elc in `tools/compile.el` script. Close #147, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 31de569656 273/472: Extend pacmacs--normalize-wall-bits UT, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4624b8a64c 307/472: Rename ghost-blinking-threshold cons (#159), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs af0fe59457 309/472: Fix FIXME regarding Emacs 24.3 support (#159), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0326ad4081 318/472: Add module for working with vectors (#159), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 84598f8f20 328/472: UT for pacmacs--load-next-level, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4862789072 335/472: Terrify/unterrify ghost without losing state,
ELPA Syncer <=
- [nongnu] elpa/pacmacs 1e4d6cd8b7 340/472: UT for terrified-ghost function (#171), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 3e25c67590 345/472: Add script for semi-automatic ATT measuring, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 70d381a0ca 362/472: UT for terrify-all-ghosts (#173), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs dec42c790d 374/472: Update the screenshots, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 10705b45c5 376/472: Rename bits-to-xpm to wall-tile-to-xpm (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a5583b6255 377/472: Fix wall-tile-to-xpm UT (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 93f031ae4e 382/472: Fix create-wall-tile UT (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 2c7e23070b 380/472: Fix put-vertical-bar UT (#138), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs dc14097468 400/472: Add emacs mode for game over (#134), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 98816141d5 398/472: Merge pull request #189 from codingteam/remove-make-terrified-ghost, ELPA Syncer, 2022/01/06