diff --git a/forest/firefly-1.png b/forest/firefly-1.png new file mode 100644 index 0000000..aaf09a9 Binary files /dev/null and b/forest/firefly-1.png differ diff --git a/forest/firefly-2.png b/forest/firefly-2.png new file mode 100644 index 0000000..f04f875 Binary files /dev/null and b/forest/firefly-2.png differ diff --git a/forest/forest.fasl b/forest/forest.fasl new file mode 100644 index 0000000..3d457ba Binary files /dev/null and b/forest/forest.fasl differ diff --git a/forest/forest.lisp b/forest/forest.lisp index b4a8eab..d7667d4 100644 --- a/forest/forest.lisp +++ b/forest/forest.lisp @@ -61,6 +61,12 @@ (nth (truncate (/ dist 2)) *earth-tiles*) "floor")))) +;;; The tree + +(defcell tree + (tile :initform "tree-1") + (categories :initform '(:obstacle :opaque))) + ;;; The player (defcell player @@ -102,18 +108,42 @@ (dotimes (j ) [drop-cell self (clone =earth=) i j]))) +(define-method drop-trees forest (&optional &key (object =tree=) + distance + (row 0) (column 0) + (graininess 0.3) + (density 100) + (cutoff 0)) + (clon:with-field-values (height width) self + (let* ((h0 (or distance height)) + (w0 (or distance width)) + (r0 (- row (truncate (/ h0 2)))) + (c0 (- column (truncate (/ w0 2)))) + (plasma (xe2:render-plasma h0 w0 :graininess graininess)) + (value nil)) + (dotimes (i h0) + (dotimes (j w0) + (setf value (aref plasma i j)) + (when (< cutoff value) + (when (or (null distance) + (< (distance (+ j r0) (+ c0 i) row column) distance)) + (percent-of-time density + [drop-cell self (clone object) (+ r0 i) (+ c0 j) :no-collisions t])))))))) + (define-method generate forest (&key (height *forest-size*) (width *forest-size*)) (setf height) (setf width) [create-default-grid self] [drop-earth self] + [drop-trees self :graininess 0.08 :density 30] [drop-cell self (clone =drop-point=) - (1+ (random 10)) - (1+ (random 10)) + (1+ (random 50)) + (1+ (random 50)) :exclusive t :probe t]) (define-method begin-ambient-loop forest () + (play-sample "lutey") (play-music "nightbird" :loop t)) ;;; Controlling the game diff --git a/forest/forest.org b/forest/forest.org index 93672c9..1b14dd7 100644 --- a/forest/forest.org +++ b/forest/forest.org @@ -5,3 +5,4 @@ woods to clearing. follow the bird. watercolor look. lighting effects. game occurs, you explore ruins at night , re-use vm0 art lightning bugs ** TODO earth tiles light up based on distance from player. +** TODO FIX when key pressed+released before :idle is run diff --git a/forest/forest.pak b/forest/forest.pak index effec82..d78a366 100644 --- a/forest/forest.pak +++ b/forest/forest.pak @@ -20,6 +20,9 @@ (:name "ball" :type :image :file "ball.png") (:name "wall" :type :image :file "wall.png") (:name "ouch" :type :sample :file "ouch.wav" :properties (:volume 10)) + (:name "lutey" :type :sample :file "lutey.wav" :properties (:volume 31)) + (:name "firefly-1" :type :image :file "firefly-1.png") + (:name "firefly-2" :type :image :file "firefly-2.png") (:name "nightbird" :type :music :file "nightbird.ogg" :properties (:volume 20)) (:name "rain" :type :music :file "rain.ogg" :properties (:volume 20)) (:name "thunder-med" :type :music :file "thunder-med.ogg" :properties (:volume 20)) diff --git a/forest/lutey.wav b/forest/lutey.wav new file mode 100644 index 0000000..b67340e Binary files /dev/null and b/forest/lutey.wav differ diff --git a/forest/tree-1.png b/forest/tree-1.png new file mode 100644 index 0000000..d21c15c Binary files /dev/null and b/forest/tree-1.png differ