diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/09-ghoulspree.lisp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/examples/09-ghoulspree.lisp b/examples/09-ghoulspree.lisp index 896f470..33a5423 100644 --- a/examples/09-ghoulspree.lisp +++ b/examples/09-ghoulspree.lisp @@ -100,17 +100,8 @@ on which boundary VAL is outside of." (loop for ghoul across (ww::application-scene app) do (advance-pos ghoul) when gravity - do (apply-gravity-to ghoul accelleration) - when (out-of-bounds-p ghoul) - ;; note, it is generally a BadIdeaâ„¢ to delete - ;; something from an array that you are iterating - ;; over. It only works as expected here b/c of - ;; implicit knowledge about the imlementation of the - ;; scene container. A safer way in most cases would be - ;; to `collect ghoul into drop-list` and then deleted - ;; all the collected ghouls in a `finally` clause, - ;; or to use ww::drop-unit-if in a `finally` clause. - do (ww:drop-unit ghoul))))) + do (apply-gravity-to ghoul accelleration))) + (ww::drop-unit-if #'out-of-bounds-p))) (defun random-sign () (if (zerop (random 2)) -1 1)) |