mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-04 08:47:11 +00:00
Do interactive mode tagging for snake.el
This commit is contained in:
parent
928b643a28
commit
73a6ab0a1b
@ -336,38 +336,38 @@ Argument SNAKE-BUFFER is the name of the buffer."
|
||||
|
||||
(defun snake-move-left ()
|
||||
"Make the snake move left."
|
||||
(interactive)
|
||||
(interactive nil snake-mode)
|
||||
(when (zerop (snake-final-x-velocity))
|
||||
(push '(-1 0) snake-velocity-queue)))
|
||||
|
||||
(defun snake-move-right ()
|
||||
"Make the snake move right."
|
||||
(interactive)
|
||||
(interactive nil snake-mode)
|
||||
(when (zerop (snake-final-x-velocity))
|
||||
(push '(1 0) snake-velocity-queue)))
|
||||
|
||||
(defun snake-move-up ()
|
||||
"Make the snake move up."
|
||||
(interactive)
|
||||
(interactive nil snake-mode)
|
||||
(when (zerop (snake-final-y-velocity))
|
||||
(push '(0 -1) snake-velocity-queue)))
|
||||
|
||||
(defun snake-move-down ()
|
||||
"Make the snake move down."
|
||||
(interactive)
|
||||
(interactive nil snake-mode)
|
||||
(when (zerop (snake-final-y-velocity))
|
||||
(push '(0 1) snake-velocity-queue)))
|
||||
|
||||
(defun snake-end-game ()
|
||||
"Terminate the current game."
|
||||
(interactive)
|
||||
(interactive nil snake-mode)
|
||||
(gamegrid-kill-timer)
|
||||
(use-local-map snake-null-map)
|
||||
(gamegrid-add-score snake-score-file snake-score))
|
||||
|
||||
(defun snake-start-game ()
|
||||
"Start a new game of Snake."
|
||||
(interactive)
|
||||
(interactive nil snake-mode)
|
||||
(snake-reset-game)
|
||||
(snake-set-dot)
|
||||
(use-local-map snake-mode-map)
|
||||
@ -375,7 +375,7 @@ Argument SNAKE-BUFFER is the name of the buffer."
|
||||
|
||||
(defun snake-pause-game ()
|
||||
"Pause (or resume) the current game."
|
||||
(interactive)
|
||||
(interactive nil snake-mode)
|
||||
(setq snake-paused (not snake-paused))
|
||||
(message (and snake-paused "Game paused (press p to resume)")))
|
||||
|
||||
@ -386,6 +386,7 @@ Argument SNAKE-BUFFER is the name of the buffer."
|
||||
|
||||
(define-derived-mode snake-mode special-mode "Snake"
|
||||
"A mode for playing Snake."
|
||||
:interactive nil
|
||||
|
||||
(add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user