Skip to content

Commit

Permalink
flesh of passage
Browse files Browse the repository at this point in the history
  • Loading branch information
David O'Toole committed Dec 12, 2009
1 parent 64462bc commit 961d403
Show file tree
Hide file tree
Showing 16 changed files with 121 additions and 11 deletions.
17 changes: 12 additions & 5 deletions console.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,17 @@ resource is stored; see also `find-resource'."
(defvar *module-directories*
(list (make-pathname :directory
(pathname-directory
(load-time-value
(or #.*compile-file-truename* *load-truename*))))
;; auto-config via sb-ext
(make-pathname :directory (pathname-directory (car sb-ext:*posix-argv*))))
(make-pathname
:host (pathname-host #.(or *compile-file-truename*
*load-truename*))
:device (pathname-device #.(or *compile-file-truename*
*load-truename*))
:directory (pathname-directory #.(or *compile-file-truename*
*load-truename*))))))
;; (load-time-value
;; (or #.*compile-file-truename* *load-truename*))))
;; ;; auto-config via sb-ext
;; (make-pathname :directory (pathname-directory (car sb-ext:*posix-argv*))))
"List of directories where XE2 will search for modules.
Directories are searched in list order.")

Expand Down Expand Up @@ -1395,7 +1402,7 @@ and its .startup resource is loaded."
;; (when (eq :music (resource-type resource))
;; (sdl-mixer:free (resource-object resource))))
;; *resource-table*))


;;; Saving and loading data
;;; Taking screenshots
Expand Down
Binary file added forest/bark.wav
Binary file not shown.
Binary file added forest/death.wav
Binary file not shown.
Binary file modified forest/earth-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 modified forest/earth-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 modified forest/earth-3.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 modified forest/forest.fasl
Binary file not shown.
96 changes: 94 additions & 2 deletions forest/forest.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,96 @@ It has begun to snow."
[play-sample self "dead"]
[parent>>die self])

;;; Wolves are the most difficult enemies.

(defcell wolf
(categories :initform '(:actor :target :obstacle :opaque :enemy))
(dexterity :initform (make-stat :base 20))
(max-items :initform (make-stat :base 1))
(speed :initform (make-stat :base 2))
(chase-distance :initform 10)
(stepping :initform t)
(behavior :initform :seeking)
(clock :initform 0)
(last-direction :initform :north)
(strength :initform (make-stat :base 50))
(movement-cost :initform (make-stat :base 10))
(tile :initform "wolf")
(target :initform nil)
(hit-points :initform (make-stat :base 9 :min 0 :max 40))
(description :initform
"These undead wolves will devour your flesh if they get the chance."))

(define-method run wolf ()
(ecase <behavior>
(:seeking [seek self])
(:fleeing [flee self])))

(define-method seek wolf ()
(clon:with-field-values (row column) self
(when (< [distance-to-player *world* row column] <chase-distance>)
(let ((direction [direction-to-player *world* row column])
(world *world*))
(percent-of-time 5 [play-sample self (car (one-of '("growl-1" "growl-2")))])
(if [adjacent-to-player world row column]
(progn
(percent-of-time 80
[say self "The undead wolf bites you."]
[damage [get-player *world*] 6])
(setf <clock> 6
<behavior> :fleeing))
(if [obstacle-in-direction-p world row column direction]
(let ((target [target-in-direction-p world row column direction]))
(if (and target (not [in-category target :enemy]))
(progn nil)
(progn (setf <direction> (random-direction))
[>>move self direction])))
(progn (when (< 7 (random 10))
(setf <direction> (random-direction)))
[>>move self direction])))))))

(define-method damage wolf (points)
[play-sample self "bark"]
[parent>>damage self points])

(define-method die wolf ()
[play-sample self "yelp"]
[parent>>die self])

(define-method flee wolf ()
(decf <clock>)
;; are we done fleeing? then begin seeking.
(if (<= <clock> 0)
(setf <behavior> :seeking)
;; otherwise, flee
(clon:with-field-values (row column) self
(let ((player-row [player-row *world*])
(player-column [player-column *world*]))
(labels ((neighbor (r c direction)
(multiple-value-bind (r0 c0)
(step-in-direction r c direction)
(list r0 c0)))
(all-neighbors (r c)
(let (ns)
(dolist (dir *compass-directions*)
(push (neighbor r c dir) ns))
ns))
(score (r c)
(distance player-column player-row c r)))
(let* ((neighbors (all-neighbors row column))
(scores (mapcar #'(lambda (pair)
(apply #'score pair))
neighbors))
(farthest (apply #'max scores))
(square (nth (position farthest scores)
neighbors)))
(destructuring-bind (r c) square
[move self (xe2:direction-to row column r c)])))))))

(define-method move wolf (direction)
(setf <last-direction> direction)
[parent>>move self direction])

;;; Bodies of other adventurers

(defcell arrows
Expand All @@ -687,7 +777,7 @@ It has begun to snow."
[take stepper :direction :here :category :item]))

(define-method use herb (user)
(when (and user (has-field :hit-points user))
(when (and user (has-field :hit-points user))
(prog1 t
[stat-effect user :hit-points 12]
[say self "You consume the healing herb and quickly feel better."])))
Expand Down Expand Up @@ -1030,6 +1120,7 @@ south. You can hear the monks singing in the distance.")
(prog1 nil
[drop-cell *world* (clone =mountain=) r c])))
(trace-row #'drop-mountain i 0 (+ offset (random 4)))
(percent-of-time 10 [drop-cell self (clone =wolf=) i (+ offset (random 4))])
(trace-row #'drop-mountain i (+ offset (random 4) 20) <width>)))
;; drop monastery gateway
(let ((column (+ offset (random 10)))
Expand Down Expand Up @@ -1060,6 +1151,7 @@ south. You can hear the monks singing in the distance.")

(define-method begin-ambient-loop passage ()
(play-music "passageway" :loop t)
(play-sample "howl")
(play-sample "thunder-big"))

(define-method generate passage (&key (height *forest-height*)
Expand Down Expand Up @@ -1260,7 +1352,7 @@ south. You can hear the monks singing in the distance.")
[newline quickhelp]))
;;
[play universe
:address (generate-level-address 1)
:address (generate-level-address 3)
:player player
:narrator narrator
:prompt prompt
Expand Down
6 changes: 4 additions & 2 deletions forest/forest.org
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
** TODO indicate edge of map with chevrons. piece together maps.
** TODO overworld map? (FUTURE)
** TODO fix in-game map!
** TODO fix in-game map scrolling off bottom of viewport
** TODO find in-game notes with same color scheme text as scroll
** TODO snow wolves and archer skels
** TODO snow wolves and archer skels in passage
** TODO find food on dead adventurer in passage, plus note
** TODO longer level approach to monastery, talk to a few npcs, follow a road and cross fences
** TODO don't place bodies in walls
** TODO fix arrows not dying
** TODO record music/chant vox samples for monastery approach
Expand Down
9 changes: 9 additions & 0 deletions forest/forest.pak
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
(:name "unh-2" :type :sample :file "unh-2.wav" :properties (:volume 20))
(:name "unh-3" :type :sample :file "unh-3.wav" :properties (:volume 20))

(:name "growl-1" :type :sample :file "growl-1.wav" :properties (:volume 20))
(:name "growl-2" :type :sample :file "growl-2.wav" :properties (:volume 20))
(:name "howl" :type :sample :file "howl.wav" :properties (:volume 20))
(:name "bark" :type :sample :file "bark.wav" :properties (:volume 20))
(:name "yelp" :type :sample :file "yelp.wav" :properties (:volume 20))

(:name "snowflake" :type :image :file "snowflake.png")
(:name "monastery" :type :image :file "monastery.png")
(:name "monastery-gateway" :type :image :file "monastery-gateway.png")
Expand All @@ -58,11 +64,13 @@

(:name "body" :type :image :file "body.png")
(:name "skull" :type :image :file "skull.png")
(:name "wolf" :type :image :file "wolf.png")
(:name "raindrop" :type :image :file "raindrop.png")
(:name "skeleton" :type :image :file "skel.png")
(:name "gravestone" :type :image :file "gravestone.png")
(:name "wooden-bow" :type :image :file "wooden-bow.png")


(:name "quickhelp-message" :type :formatted-text :file "quickhelp.text")

(:name "player" :type :image :file "player.png")
Expand All @@ -73,6 +81,7 @@
(:name "character-pink" :type :image :file "character-pink.png")
(:name "ball" :type :image :file "ball.png")
(:name "wall" :type :image :file "wall.png")
(:name "death" :type :sample :file "death.wav" :properties (:volume 40))
(:name "monks" :type :sample :file "monks.wav" :properties (:volume 25))
(:name "talk" :type :sample :file "talk.wav" :properties (:volume 10))
(:name "lutey" :type :sample :file "lutey.wav" :properties (:volume 31))
Expand Down
Binary file added forest/growl-1.wav
Binary file not shown.
Binary file added forest/growl-2.wav
Binary file not shown.
Binary file added forest/howl.wav
Binary file not shown.
Binary file added forest/wolf.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/yelp.wav
Binary file not shown.
4 changes: 2 additions & 2 deletions xong/xong.org
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
** TODO more XONG tutorial stuff, show snake mechanic
** TODO puckman level, show brick in text
** TODO border playfield
** TODO soften worlds transition?
** TODO soften worlds transition? / wipe?
** TODO always indicate player pos with bubble or big arrow?
** TODO recursive serialization
** TODO LEVEL EDITING TURTLE CURSOR
** TODO fire that spreads and must be put out
** TODO more paint mechanics.. no instadeath on snake, instead he fires
** TODO TUTORIAL LEVEL FOR 1.4
** TODO fix letting go of alt while holding dir spams chevron message
** TODO YOU ARE HERE arrow on game start
** TODO OFFTOPIC: melange of nice parts of certain B-side tracks for GOLD
Expand Down

0 comments on commit 961d403

Please sign in to comment.