From 9319d7173f60bb1359daa05d9b58a60ed9badee3 Mon Sep 17 00:00:00 2001 From: larstvei Date: Mon, 29 Sep 2014 23:15:28 +0200 Subject: [PATCH] Adjusted levels. --- etype.el | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/etype.el b/etype.el index f7fffe4..fa1dacb 100644 --- a/etype.el +++ b/etype.el @@ -202,19 +202,17 @@ random time between 1 and 10 seconds." etype-timers)))) (defun etype-spawn-wave (&optional recur) - "" + "Spawn multiple words according to ETYPE-LEVEL." (save-excursion - (when etype-in-game - (let ((inhibit-read-only t)) + (let ((inhibit-read-only t)) + (when (< recur (etype-wave-limit)) (etype-spawn-word) - (when recur - (run-at-time (etype-random-spawn-time) nil 'etype-spawn-wave t) - (dotimes (i (+ (random 10) etype-level)) - (run-at-time (etype-random-spawn-time) - nil 'etype-spawn-wave))))))) + (run-at-time (/ (etype-random) 5) nil + 'etype-spawn-wave (1+ recur)))))) -(defun etype-random-spawn-time () - (- 30 (* (etype-random) (expt etype-level 1.2)))) +(defun etype-wave-limit () + (+ (* etype-level etype-level) 5 + (if (plusp etype-score) (ceiling (log etype-score)) 0))) (defun etype-move-shooter (column) "Moves the shooter to COLUMN." @@ -308,7 +306,7 @@ point. If the word is complete the word is cleared." (etype-update-score word) (goto-char (point-min)) (unless etype-words-in-play - (etype-spawn-wave t)))) + (etype-spawn-wave 0)))) (defun etype-catch-input () "'self-insert-command' is remapped to this function. Instead of @@ -325,9 +323,7 @@ inserting the typed key, it triggers a shot." (switch-to-buffer "Etype") (etype-mode) (init-game) - (run-at-time 0 nil 'etype-spawn-wave t) - (dotimes (i 10) - (run-at-time (random 10) nil 'etype-spawn-wave))) + (run-at-time 0 nil 'etype-spawn-wave 0)) (defun etype-cleanup () "Cancels all etype-timers."