Skip to content

Commit

Permalink
foo
Browse files Browse the repository at this point in the history
  • Loading branch information
David O'Toole committed Dec 9, 2009
1 parent ceb79cb commit be46bf4
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 2 deletions.
Binary file added forest/firefly-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added forest/firefly-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added forest/forest.fasl
Binary file not shown.
34 changes: 32 additions & 2 deletions forest/forest.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -102,18 +108,42 @@
(dotimes (j <width>)
[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> height)
(setf <width> 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
Expand Down
1 change: 1 addition & 0 deletions forest/forest.org
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions forest/forest.pak
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Binary file added forest/lutey.wav
Binary file not shown.
Binary file added forest/tree-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be46bf4

Please sign in to comment.