diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/09-ghoulspree.lisp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/09-ghoulspree.lisp b/examples/09-ghoulspree.lisp index 03552f0..a11e6a6 100644 --- a/examples/09-ghoulspree.lisp +++ b/examples/09-ghoulspree.lisp @@ -102,7 +102,14 @@ on which boundary VAL is outside of." when gravity do (apply-gravity-to ghoul accelleration) when (out-of-bounds-p ghoul) - do (ww:drop-unit 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. + do (ww:drop-unit ghoul))))) (defun random-sign () (if (zerop (random 2)) -1 1)) |