diff options
| author | Eli Zaretskii | 2007-03-03 12:14:46 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2007-03-03 12:14:46 +0000 |
| commit | 297a6dcaff55833a5eed29dc47d37a854d9fe80e (patch) | |
| tree | cc95ce197ba1902d07492f3c720edff6d0cff42e | |
| parent | 362bcf23fe813c32b30676282262c79ae0648ecd (diff) | |
| download | emacs-297a6dcaff55833a5eed29dc47d37a854d9fe80e.tar.gz emacs-297a6dcaff55833a5eed29dc47d37a854d9fe80e.zip | |
(tetris-move-bottom, tetris-move-left)
(tetris-move-right, tetris-rotate-prev, tetris-rotate-next): Do nothing when
the game is paused.
| -rw-r--r-- | lisp/play/tetris.el | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el index 53305a08e66..f1901a129dd 100644 --- a/lisp/play/tetris.el +++ b/lisp/play/tetris.el | |||
| @@ -512,19 +512,21 @@ Drops the shape one square, testing for collision." | |||
| 512 | (defun tetris-move-bottom () | 512 | (defun tetris-move-bottom () |
| 513 | "Drops the shape to the bottom of the playing area" | 513 | "Drops the shape to the bottom of the playing area" |
| 514 | (interactive) | 514 | (interactive) |
| 515 | (let ((hit nil)) | 515 | (if (not tetris-paused) |
| 516 | (tetris-erase-shape) | 516 | (let ((hit nil)) |
| 517 | (while (not hit) | 517 | (tetris-erase-shape) |
| 518 | (setq tetris-pos-y (1+ tetris-pos-y)) | 518 | (while (not hit) |
| 519 | (setq hit (tetris-test-shape))) | 519 | (setq tetris-pos-y (1+ tetris-pos-y)) |
| 520 | (setq tetris-pos-y (1- tetris-pos-y)) | 520 | (setq hit (tetris-test-shape))) |
| 521 | (tetris-draw-shape) | 521 | (setq tetris-pos-y (1- tetris-pos-y)) |
| 522 | (tetris-shape-done))) | 522 | (tetris-draw-shape) |
| 523 | (tetris-shape-done)))) | ||
| 523 | 524 | ||
| 524 | (defun tetris-move-left () | 525 | (defun tetris-move-left () |
| 525 | "Moves the shape one square to the left" | 526 | "Moves the shape one square to the left" |
| 526 | (interactive) | 527 | (interactive) |
| 527 | (unless (= tetris-pos-x 0) | 528 | (unless (or (= tetris-pos-x 0) |
| 529 | tetris-paused) | ||
| 528 | (tetris-erase-shape) | 530 | (tetris-erase-shape) |
| 529 | (setq tetris-pos-x (1- tetris-pos-x)) | 531 | (setq tetris-pos-x (1- tetris-pos-x)) |
| 530 | (if (tetris-test-shape) | 532 | (if (tetris-test-shape) |
| @@ -534,8 +536,9 @@ Drops the shape one square, testing for collision." | |||
| 534 | (defun tetris-move-right () | 536 | (defun tetris-move-right () |
| 535 | "Moves the shape one square to the right" | 537 | "Moves the shape one square to the right" |
| 536 | (interactive) | 538 | (interactive) |
| 537 | (unless (= (+ tetris-pos-x (tetris-shape-width)) | 539 | (unless (or (= (+ tetris-pos-x (tetris-shape-width)) |
| 538 | tetris-width) | 540 | tetris-width) |
| 541 | tetris-paused) | ||
| 539 | (tetris-erase-shape) | 542 | (tetris-erase-shape) |
| 540 | (setq tetris-pos-x (1+ tetris-pos-x)) | 543 | (setq tetris-pos-x (1+ tetris-pos-x)) |
| 541 | (if (tetris-test-shape) | 544 | (if (tetris-test-shape) |
| @@ -545,20 +548,23 @@ Drops the shape one square, testing for collision." | |||
| 545 | (defun tetris-rotate-prev () | 548 | (defun tetris-rotate-prev () |
| 546 | "Rotates the shape clockwise" | 549 | "Rotates the shape clockwise" |
| 547 | (interactive) | 550 | (interactive) |
| 548 | (tetris-erase-shape) | 551 | (if (not tetris-paused) |
| 549 | (setq tetris-rot (% (+ 1 tetris-rot) 4)) | 552 | (progn (tetris-erase-shape) |
| 550 | (if (tetris-test-shape) | 553 | (setq tetris-rot (% (+ 1 tetris-rot) 4)) |
| 551 | (setq tetris-rot (% (+ 3 tetris-rot) 4))) | 554 | (if (tetris-test-shape) |
| 552 | (tetris-draw-shape)) | 555 | (setq tetris-rot (% (+ 3 tetris-rot) 4))) |
| 556 | (tetris-draw-shape)))) | ||
| 553 | 557 | ||
| 554 | (defun tetris-rotate-next () | 558 | (defun tetris-rotate-next () |
| 555 | "Rotates the shape anticlockwise" | 559 | "Rotates the shape anticlockwise" |
| 556 | (interactive) | 560 | (interactive) |
| 557 | (tetris-erase-shape) | 561 | (if (not tetris-paused) |
| 558 | (setq tetris-rot (% (+ 3 tetris-rot) 4)) | 562 | (progn |
| 559 | (if (tetris-test-shape) | 563 | (tetris-erase-shape) |
| 560 | (setq tetris-rot (% (+ 1 tetris-rot) 4))) | 564 | (setq tetris-rot (% (+ 3 tetris-rot) 4)) |
| 561 | (tetris-draw-shape)) | 565 | (if (tetris-test-shape) |
| 566 | (setq tetris-rot (% (+ 1 tetris-rot) 4))) | ||
| 567 | (tetris-draw-shape)))) | ||
| 562 | 568 | ||
| 563 | (defun tetris-end-game () | 569 | (defun tetris-end-game () |
| 564 | "Terminates the current game" | 570 | "Terminates the current game" |