mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-04-23 06:21:29 -07:00
(tetris-move-bottom, tetris-move-left)
(tetris-move-right, tetris-rotate-prev, tetris-rotate-next): Do nothing when the game is paused.
This commit is contained in:
parent
362bcf23fe
commit
297a6dcaff
1 changed files with 27 additions and 21 deletions
|
|
@ -512,19 +512,21 @@ Drops the shape one square, testing for collision."
|
|||
(defun tetris-move-bottom ()
|
||||
"Drops the shape to the bottom of the playing area"
|
||||
(interactive)
|
||||
(let ((hit nil))
|
||||
(tetris-erase-shape)
|
||||
(while (not hit)
|
||||
(setq tetris-pos-y (1+ tetris-pos-y))
|
||||
(setq hit (tetris-test-shape)))
|
||||
(setq tetris-pos-y (1- tetris-pos-y))
|
||||
(tetris-draw-shape)
|
||||
(tetris-shape-done)))
|
||||
(if (not tetris-paused)
|
||||
(let ((hit nil))
|
||||
(tetris-erase-shape)
|
||||
(while (not hit)
|
||||
(setq tetris-pos-y (1+ tetris-pos-y))
|
||||
(setq hit (tetris-test-shape)))
|
||||
(setq tetris-pos-y (1- tetris-pos-y))
|
||||
(tetris-draw-shape)
|
||||
(tetris-shape-done))))
|
||||
|
||||
(defun tetris-move-left ()
|
||||
"Moves the shape one square to the left"
|
||||
(interactive)
|
||||
(unless (= tetris-pos-x 0)
|
||||
(unless (or (= tetris-pos-x 0)
|
||||
tetris-paused)
|
||||
(tetris-erase-shape)
|
||||
(setq tetris-pos-x (1- tetris-pos-x))
|
||||
(if (tetris-test-shape)
|
||||
|
|
@ -534,8 +536,9 @@ Drops the shape one square, testing for collision."
|
|||
(defun tetris-move-right ()
|
||||
"Moves the shape one square to the right"
|
||||
(interactive)
|
||||
(unless (= (+ tetris-pos-x (tetris-shape-width))
|
||||
tetris-width)
|
||||
(unless (or (= (+ tetris-pos-x (tetris-shape-width))
|
||||
tetris-width)
|
||||
tetris-paused)
|
||||
(tetris-erase-shape)
|
||||
(setq tetris-pos-x (1+ tetris-pos-x))
|
||||
(if (tetris-test-shape)
|
||||
|
|
@ -545,20 +548,23 @@ Drops the shape one square, testing for collision."
|
|||
(defun tetris-rotate-prev ()
|
||||
"Rotates the shape clockwise"
|
||||
(interactive)
|
||||
(tetris-erase-shape)
|
||||
(setq tetris-rot (% (+ 1 tetris-rot) 4))
|
||||
(if (tetris-test-shape)
|
||||
(setq tetris-rot (% (+ 3 tetris-rot) 4)))
|
||||
(tetris-draw-shape))
|
||||
(if (not tetris-paused)
|
||||
(progn (tetris-erase-shape)
|
||||
(setq tetris-rot (% (+ 1 tetris-rot) 4))
|
||||
(if (tetris-test-shape)
|
||||
(setq tetris-rot (% (+ 3 tetris-rot) 4)))
|
||||
(tetris-draw-shape))))
|
||||
|
||||
(defun tetris-rotate-next ()
|
||||
"Rotates the shape anticlockwise"
|
||||
(interactive)
|
||||
(tetris-erase-shape)
|
||||
(setq tetris-rot (% (+ 3 tetris-rot) 4))
|
||||
(if (tetris-test-shape)
|
||||
(setq tetris-rot (% (+ 1 tetris-rot) 4)))
|
||||
(tetris-draw-shape))
|
||||
(if (not tetris-paused)
|
||||
(progn
|
||||
(tetris-erase-shape)
|
||||
(setq tetris-rot (% (+ 3 tetris-rot) 4))
|
||||
(if (tetris-test-shape)
|
||||
(setq tetris-rot (% (+ 1 tetris-rot) 4)))
|
||||
(tetris-draw-shape))))
|
||||
|
||||
(defun tetris-end-game ()
|
||||
"Terminates the current game"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue