emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d6d545b: * lisp/play/tetris.el (tetris-move-down):


From: Stefan Monnier
Subject: [Emacs-diffs] master d6d545b: * lisp/play/tetris.el (tetris-move-down): New command (bug#21360)
Date: Tue, 08 Sep 2015 17:55:54 +0000

branch: master
commit d6d545bf7636b7b7678ea85e58a41b6bf0b860ec
Author: Vasilij Schneidermann <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * lisp/play/tetris.el (tetris-move-down): New command (bug#21360)
    
    (tetris-mode-map): Use it.
    
    Copyright-paperwork-exempt: yes
---
 lisp/play/tetris.el |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el
index 586d1d5..0f3b758 100644
--- a/lisp/play/tetris.el
+++ b/lisp/play/tetris.el
@@ -265,7 +265,7 @@ each one of its four blocks.")
     (define-key map [left]     'tetris-move-left)
     (define-key map [right]    'tetris-move-right)
     (define-key map [up]       'tetris-rotate-prev)
-    (define-key map [down]     'tetris-rotate-next)
+    (define-key map [down]     'tetris-move-down)
     map))
 
 (defvar tetris-null-map
@@ -524,6 +524,16 @@ Drops the shape one square, testing for collision."
        (setq tetris-pos-x (1- tetris-pos-x)))
     (tetris-draw-shape)))
 
+(defun tetris-move-down ()
+  "Move the shape one square to the bottom."
+  (interactive)
+  (unless tetris-paused
+    (tetris-erase-shape)
+    (setq tetris-pos-y (1+ tetris-pos-y))
+    (if (tetris-test-shape)
+       (setq tetris-pos-y (1- tetris-pos-y)))
+    (tetris-draw-shape)))
+
 (defun tetris-rotate-prev ()
   "Rotate the shape clockwise."
   (interactive)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]