;;; bubbles.el --- Puzzle game for Emacs.
-;; Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2011 Free Software Foundation, Inc.
;; Author: Ulf Jasper <ulf.jasper@web.de>
;; URL: http://ulf.epplejasper.de/
(defconst bubbles-version "0.5" "Version number of bubbles.el.")
(require 'gamegrid)
-(require 'cl)
+(eval-when-compile (require 'cl)) ; for 'case
;; User options
(defcustom bubbles-shift-mode
'default
"Shift mode.
-Available modes are `shift-default' and`shift-always'."
+Available modes are `shift-default' and `shift-always'."
:type '(radio (const :tag "Default" default)
(const :tag "Shifter" always)
;;(const :tag "Mega Shifter" 'mega)
(defsubst bubbles--empty-char ()
"The character used for removed bubbles (empty grid cells)."
- ? )
+ ?\s)
(defun bubbles-set-graphics-theme-ascii ()
"Set graphics theme to `ascii'."
map)
"Mode map for bubbles.")
-(defun bubbles-mode ()
+(define-derived-mode bubbles-mode nil "Bubbles"
"Major mode for playing bubbles.
\\{bubbles-mode-map}"
- (kill-all-local-variables)
- (use-local-map bubbles-mode-map)
- (setq major-mode 'bubbles-mode)
- (setq mode-name "Bubbles")
(setq buffer-read-only t)
(buffer-disable-undo)
- (setq buffer-undo-list t)
(force-mode-line-update)
(redisplay)
- (add-hook 'post-command-hook 'bubbles--mark-neighbourhood t t)
- (run-hooks 'bubbles-mode-hook))
+ (add-hook 'post-command-hook 'bubbles--mark-neighbourhood t t))
;;;###autoload
(defun bubbles ()
- "Play Bubbles game."
+ "Play Bubbles game.
+\\<bubbles-mode-map>
+The goal is to remove all bubbles with as few moves as possible.
+\\[bubbles-plop] on a bubble removes that bubble and all
+connected bubbles of the same color. Unsupported bubbles fall
+down, and columns that do not contain any bubbles suck the
+columns on its right towards the left.
+
+\\[bubbles-set-game-easy] sets the difficulty to easy.
+\\[bubbles-set-game-medium] sets the difficulty to medium.
+\\[bubbles-set-game-difficult] sets the difficulty to difficult.
+\\[bubbles-set-game-hard] sets the difficulty to hard."
(interactive)
(switch-to-buffer (get-buffer-create "*bubbles*"))
(when (or (not bubbles--playing)
(bubbles--update-score))
(defun bubbles--update-score ()
- "Calculate and display new bubble score."
+ "Calculate and display new bubbles score."
(setq bubbles--score (+ bubbles--score bubbles--neighbourhood-score))
(bubbles--show-scores))
(g (nth 1 crgb))
(b (nth 2 crgb))
(brightness (/ (+ r g b) 3.0 256 256))
- (val (sin (* brightness (/ pi 2))))
+ (val (sin (* brightness (/ float-pi 2))))
(rr (* red val))
(gg (* green val))
(bb (* blue val))
(provide 'bubbles)
-;; arch-tag: 2cd7237a-b0ad-400d-a7fd-75f676dceb70
;;; bubbles.el ends here