[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 86f76c4bef 129/472: Implement switching level mech
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 86f76c4bef 129/472: Implement switching level mechanics. Close #79 |
Date: |
Thu, 6 Jan 2022 21:59:18 -0500 (EST) |
branch: elpa/pacmacs
commit 86f76c4bef56663eaae2af5be1c0f972db9b23fa
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Implement switching level mechanics. Close #79
---
maps/map01.txt | 2 +-
maps/map02.txt | 2 +-
maps/map03.txt | 2 +-
maps/map04.txt | 2 +-
maps/map06.txt | 2 +-
pacmacs.el | 27 +++++++++++++++++++++++----
6 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/maps/map01.txt b/maps/map01.txt
index 9cf8388efe..674169eee4 100644
--- a/maps/map01.txt
+++ b/maps/map01.txt
@@ -2,6 +2,6 @@
#.......#####
#. . #
#.g## . ##
-#. ##g . o#
+#. ## . o#
#.......####
#########
diff --git a/maps/map02.txt b/maps/map02.txt
index dd7db15c48..fe3db346f1 100644
--- a/maps/map02.txt
+++ b/maps/map02.txt
@@ -1,5 +1,5 @@
#### ####
-# #
+#. .#
# ## ## #
# #
# ## ## #
diff --git a/maps/map03.txt b/maps/map03.txt
index fc3e294953..8935913fad 100644
--- a/maps/map03.txt
+++ b/maps/map03.txt
@@ -1,5 +1,5 @@
######
-# #
+# .#
# ## #
# ## #
# ## #
diff --git a/maps/map04.txt b/maps/map04.txt
index e748cabdc7..70d8183d9d 100644
--- a/maps/map04.txt
+++ b/maps/map04.txt
@@ -1,3 +1,3 @@
#######
- o
+. o .
#######
diff --git a/maps/map06.txt b/maps/map06.txt
index 7febcfcead..4b60914044 100644
--- a/maps/map06.txt
+++ b/maps/map06.txt
@@ -1,3 +1,3 @@
############
-#o g#
+#o . g#
############
diff --git a/pacmacs.el b/pacmacs.el
index 93ddfb68af..1bdd4bb92a 100644
--- a/pacmacs.el
+++ b/pacmacs.el
@@ -76,6 +76,10 @@
(defvar pacmacs-lives 3)
(defvar pacmacs-life-icon nil)
+(defvar pacmacs-levels ["map01" "map02" "map03"
+ "map04" "map05" "map06"])
+(defvar pacmacs-current-level 0)
+
(define-derived-mode pacmacs-mode special-mode "pacmacs-mode"
(define-key pacmacs-mode-map (kbd "<up>") 'pacmacs-up)
(define-key pacmacs-mode-map (kbd "<down>") 'pacmacs-down)
@@ -89,8 +93,11 @@
(interactive)
(switch-to-buffer-other-window pacmacs-buffer-name)
(pacmacs-mode)
- (pacmacs-load-map "map05")
+
(setq pacmacs-lives 3)
+ (setq pacmacs-current-level 0)
+ (pacmacs--load-current-level)
+
(unless pacmacs-timer
(setq pacmacs-timer (run-at-time nil (* pacmacs-tick-duration-ms 0.001)
'pacmacs-tick))))
@@ -99,6 +106,14 @@
(cancel-timer pacmacs-timer)
(setq pacmacs-timer nil)))
+(defun pacmacs--load-current-level ()
+ (pacmacs-load-map (aref pacmacs-levels
+ pacmacs-current-level)))
+(defun pacmacs--switch-to-next-level ()
+ (setq pacmacs-current-level
+ (mod (1+ pacmacs-current-level)
+ (length pacmacs-levels))))
+
(defun pacmacs--make-wall-cell (row column)
(list :current-animation (pacmacs-make-anim (list (pacmacs-make-frame '(0 0
40 40) 100))
(pacmacs-create-color-block 40
40 "red"))
@@ -322,9 +337,13 @@
(when (equal pacmacs-game-state 'play)
(pacmacs-step-object pacmacs-player-state)
(pacmacs--detect-pill-collision)
- (pacmacs--detect-ghost-collision)
- (when (equal pacmacs-game-state 'play)
- (pacmacs--step-ghosts))))
+ (if pacmacs-pills
+ (progn
+ (pacmacs--detect-ghost-collision)
+ (when (equal pacmacs-game-state 'play)
+ (pacmacs--step-ghosts)))
+ (pacmacs--switch-to-next-level)
+ (pacmacs--load-current-level))))
(defun pacmacs-death-state-logic ()
(pacmacs-anim-object-next-frame pacmacs-player-state
- [nongnu] elpa/pacmacs b5078d2632 141/472: Move most of the rendering stuff to pacman-render, (continued)
- [nongnu] elpa/pacmacs b5078d2632 141/472: Move most of the rendering stuff to pacman-render, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a460cd8b06 148/472: Merge pull request #107 from rexim/feature/new-maps, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs c426f6ac91 078/472: Fix some accidental paredit typo, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 4341b23d87 094/472: Implement wraparound. Close #67, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 12942ddeff 113/472: Refactor out pacmacs--fill-board (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 91408c074d 115/472: Refactor pacmacs--track-object (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs ed40addf95 116/472: Refactor pacmacs--put-object (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs eac9d47c62 117/472: Refactor pacmacs-render-track-board (#74), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d763bd0f82 121/472: Fix the UTs, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9527a965e1 134/472: Merge branch 'switch-game-state-in-logic-functions-97'. Close #97, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 86f76c4bef 129/472: Implement switching level mechanics. Close #79,
ELPA Syncer <=
- [nongnu] elpa/pacmacs fa41daf2ca 149/472: Merge branch 'master' into score-table-92, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 85069784fb 147/472: Add a couple of new maps., ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 39fc09baf3 161/472: Load cl-lib.el for using its macros and functions, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9ddaedae20 174/472: UT for pacmacs--file-content-test, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b6141dc8e3 175/472: UT for pacmacs--anim-object-list-next-frame, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 1186dcdaa1 197/472: Double dash pacmacs-render-state function (#126), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 57b0e8566b 204/472: Get pacmacs-quit back, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 531386d7f1 208/472: Merge pull request #128 from rexim/readme-fix, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 775a2d3ec5 211/472: Convert recorder module to a tool (#115), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a0d9c1bbbc 212/472: Reverse test case before saving (#115), ELPA Syncer, 2022/01/06