[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 80f16102c5 291/472: Implement unterrifying timed o
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 80f16102c5 291/472: Implement unterrifying timed out ghosts (#153) |
Date: |
Thu, 6 Jan 2022 21:59:33 -0500 (EST) |
branch: elpa/pacmacs
commit 80f16102c5477b16e5dfda17a9f1739b81554893
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Implement unterrifying timed out ghosts (#153)
---
pacmacs.el | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/pacmacs.el b/pacmacs.el
index ef4b9a6a91..20483bceb2 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -144,6 +144,13 @@
(defun pacmacs--make-big-pill (row column)
(pacmacs--make-pill row column "Big-Pill" 50 'big-pill))
+(defun pacmacs--decrease-terrified-timers ()
+ (dolist (terrified-ghost pacmacs--terrified-ghosts)
+ (plist-map terrified-ghost :terrified-timer
+ (-lambda (terrified-timer)
+ (cl-decf terrified-timer
+ pacmacs-tick-duration-ms)))))
+
(defun pacmacs--switch-direction-animation-callback (animation-prefix)
(let ((direction-animations (-mapcat
(-lambda (direction)
@@ -175,7 +182,7 @@
:speed 1
:speed-counter 0
:type 'terrified-ghost
- :terrified-counter 5000))
+ :terrified-timer 5000))
(defun pacmacs--make-ghost (row column)
(list :row row
@@ -402,6 +409,15 @@
(pacmacs--create-game-object row column 'pacmacs--ghosts
#'pacmacs--make-ghost))
+(defun pacmacs--replace-filtered-game-objects (list-name replacing-constructor
predicate)
+ (let ((game-objects (symbol-value list-name)))
+ (dolist (game-object (-filter predicate game-objects))
+ (plist-bind ((row :row)
+ (column :column))
+ game-object
+ (funcall replacing-constructor row column))
+ (pacmacs--remove-object game-object))
+ (set list-name (-remove predicate game-objects))))
(defun pacmacs--replace-game-objects (list-name replacing-constructor)
(dolist (game-object (symbol-value list-name))
@@ -420,6 +436,13 @@
(pacmacs--replace-game-objects 'pacmacs--terrified-ghosts
#'pacmacs--create-ghost))
+(defun pacmacs--unterrify-timed-out-ghosts ()
+ (pacmacs--replace-filtered-game-objects
+ 'pacmacs--terrified-ghosts
+ #'pacmacs--create-ghost
+ (-lambda (terrified-ghost)
+ (<= (plist-get terrified-ghost :terrified-timer) 0))))
+
(defun pacmacs--detect-pill-collision ()
(plist-bind ((row :row)
(column :column))
@@ -446,6 +469,7 @@
(pacmacs--anim-object-list-next-frame pacmacs--terrified-ghosts
pacmacs-tick-duration-ms)
(pacmacs--recalc-track-board)
+ (pacmacs--unterrify-timed-out-ghosts)
(if pacmacs--pills
(progn
(pacmacs--step-object pacmacs--player-state)
@@ -455,6 +479,7 @@
(pacmacs--detect-pill-collision)
(pacmacs--step-ghosts)
(pacmacs--step-terrified-ghosts)
+ (pacmacs--decrease-terrified-timers)
(when (pacmacs--ghost-collision-p)
(dolist (ghost pacmacs--ghosts)
(pacmacs--step-back-object ghost))
- [nongnu] elpa/pacmacs 3a3ead9ac1 083/472: Support dash. Close #65, (continued)
- [nongnu] elpa/pacmacs 3a3ead9ac1 083/472: Support dash. Close #65, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 6365c3db7b 086/472: Remove ghost-state instead of player-state, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 3cbd9508d8 089/472: Merge branch 'coverage-broken-68'. Close #68, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 2331e2074c 262/472: Automate Pill sprites generating (#26), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d980f5dbe2 454/472: Introduce with-render-target macro (#203), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d813e9c62c 466/472: Merge pull request #214 from codingteam/qfix/bump-copyright-year, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b6c02d6f38 264/472: Automate Pacman Death sprites generating (#26), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 80f25498d6 270/472: Add initial UT for pacmacs--create-wall-tile, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ad201e341a 271/472: Add UT for pacmacs--bits-to-xpm, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ea74310be3 275/472: Add README for sprites. Close #148, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 80f16102c5 291/472: Implement unterrifying timed out ghosts (#153),
ELPA Syncer <=
- [nongnu] elpa/pacmacs 609416d41a 057/472: Fix delete minibuffer or sole ordinary window error. Close #42, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 43cc1205c6 066/472: Try to fix pacman-image UTs after #52, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e44bade6bf 087/472: Fix lambda expressions (#68), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 2dac90bc61 092/472: Merge branch 'entire-code-coverage-70'. Close #70, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 2fdeb1dbdf 188/472: Try to remove compilation step (#124), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a8bbb61bf8 189/472: Try to remove elcs after the compilation (#124), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7729f08230 196/472: Rename render-board to object-board (#126), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs cede2ffb48 202/472: Optimize object look up (#126):, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9e29a7aa19 207/472: Add information about cask install., ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs c6ddeab3f2 215/472: Roughly implement it replayer (#122), ELPA Syncer, 2022/01/06