[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 9a9ecb6679 283/472: Implement direction switching
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 9a9ecb6679 283/472: Implement direction switching callbacks (#153) |
Date: |
Thu, 6 Jan 2022 21:59:32 -0500 (EST) |
branch: elpa/pacmacs
commit 9a9ecb6679ee52969416f5131bc13e385e2aca01
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Implement direction switching callbacks (#153)
---
pacmacs.el | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/pacmacs.el b/pacmacs.el
index a40c7c8c4f..da302259d4 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -143,6 +143,21 @@
(defun pacmacs--make-big-pill (row column)
(pacmacs--make-pill row column "Big-Pill" 50))
+(defun pacmacs--switch-direction-animation (animation-prefix)
+ (let ((direction-animations (-mapcat
+ (-lambda (direction)
+ (->> direction
+ (symbol-name)
+ (capitalize)
+ (concat animation-prefix "-")
+ (pacmacs-load-anim)
+ (list direction)))
+ '(left right up down))))
+ (-lambda (game-object direction)
+ (plist-put game-object :direction direction)
+ (let* ((animation (plist-get direction-animations direction)))
+ (plist-put game-object :current-animation animation)))))
+
(defun pacmacs--make-ghost (row column)
(list :row row
:column column
@@ -152,10 +167,7 @@
:prev-column column
:direction 'right
:current-animation (pacmacs-load-anim "Red-Ghost-Right")
- :direction-animations (list 'left (pacmacs-load-anim "Red-Ghost-Left")
- 'right (pacmacs-load-anim
"Red-Ghost-Right")
- 'up (pacmacs-load-anim "Red-Ghost-Up")
- 'down (pacmacs-load-anim
"Red-Ghost-Down"))
+ :switch-direction-callback (pacmacs--switch-direction-animation
"Red-Ghost")
:speed 1
:speed-counter 0
:type 'ghost))
@@ -169,10 +181,7 @@
:prev-column column
:direction 'right
:current-animation (pacmacs-load-anim "Pacman-Chomping-Right")
- :direction-animations (list 'left (pacmacs-load-anim
"Pacman-Chomping-Left")
- 'right (pacmacs-load-anim
"Pacman-Chomping-Right")
- 'up (pacmacs-load-anim
"Pacman-Chomping-Up")
- 'down (pacmacs-load-anim
"Pacman-Chomping-Down"))
+ :switch-direction-callback (pacmacs--switch-direction-animation
"Pacman-Chomping")
:speed 0
:speed-counter 0
:type 'player))
@@ -224,10 +233,9 @@
(pacmacs--cell-wrapped-get pacmacs--track-board row column))
(defun pacmacs--switch-direction (game-object direction)
- (plist-bind ((direction-animations :direction-animations))
+ (plist-bind ((switch-direction-callback :switch-direction-callback))
game-object
- (plist-put game-object :direction direction)
- (plist-put game-object :current-animation (plist-get direction-animations
direction))))
+ (funcall switch-direction-callback game-object direction)))
(defun pacmacs--step-object (game-object)
(plist-bind ((row :row)
- [nongnu] elpa/pacmacs 9f9a514129 165/472: Add MELPA badge. Close #93, (continued)
- [nongnu] elpa/pacmacs 9f9a514129 165/472: Add MELPA badge. Close #93, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 02c5a40cd3 193/472: Rename cell get/set as wrapped operations (#105), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs bddb837ffd 200/472: Rename object vars according to convension (#126), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a3b2a5ce44 216/472: Replace pacmacs--file-content with f-read-text (#122), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 8f9b38b16e 233/472: Revert all the refactoring in the scope of #81, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 52fec0d180 241/472: Normalize wall generating bits (#131), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e06beacb11 242/472: Assign wall tiles on load map (#131), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9e7685b818 248/472: Drop XBM support for wall tiles (#141), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 5ec5ce8e67 267/472: Remove that pacmacs--object-at-p already!, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs c571f5874c 272/472: Extract wall bits normalization, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9a9ecb6679 283/472: Implement direction switching callbacks (#153),
ELPA Syncer <=
- [nongnu] elpa/pacmacs e710f00f69 295/472: Remove pacmacs--unterrify-all-ghosts (#153), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e1ae35d526 316/472: Minimal version of 24.4 as the package requirement, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 73fcaa8a91 324/472: Remove pacmacs--vector+ (#159), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e228a3c95d 334/472: Add 5th big pill level (#162), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4924601822 341/472: UT for unterrify-ghost function (#171), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0990672a5b 348/472: Fix stupid typos and mistakes -_-, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9cb0cbab39 352/472: Merge pull request #172 from codingteam/unterrified-original-possition-171, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 61c37f08b1 355/472: Update URL in the headers (#178), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs fad3786449 361/472: Use push instead of add-to-list (#173), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 6a91d72f35 359/472: terrify-ghost instead of reset-terrified-ghost, ELPA Syncer, 2022/01/06