diff options
author | Colin Okay <colin@cicadas.surf> | 2022-07-29 08:10:08 -0500 |
---|---|---|
committer | Colin Okay <colin@cicadas.surf> | 2022-07-29 08:10:08 -0500 |
commit | ff824c186ae3b24083feb909cdbe1fb571368c28 (patch) | |
tree | 19773b1a5b203585a28df78a06b9b1af4eaa5f8f /examples | |
parent | 420b0fd1cbd1a3b38059a1997126f5797fb6ee76 (diff) |
[example] altered to use drop-unit-if
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)) |