distance.
This commit is contained in:
@@ -8,6 +8,16 @@
|
||||
[play-clj.utils :refer :all]
|
||||
[play-clj.g2d :refer :all]))
|
||||
|
||||
(def ego-sheep-loc
|
||||
[132 140])
|
||||
|
||||
(defn dist-to-sheep [entities]
|
||||
(apply utils/dist (get-in entities [:room :entities :sheep :x]) (get-in entities [:room :entities :sheep :y])
|
||||
ego-sheep-loc))
|
||||
|
||||
(defn is-sheep-close? [entities]
|
||||
(< (dist-to-sheep entities) 45))
|
||||
|
||||
(defn wizard-dialogue [entities]
|
||||
(actions/do-dialogue entities :ego "Hello there Mr. Fangald!" :wizard "Oh no, not you again!")
|
||||
(actions/present-choices entities
|
||||
@@ -152,19 +162,27 @@
|
||||
:box [38 160 71 181]
|
||||
:script (actions/get-script
|
||||
entities
|
||||
|
||||
|
||||
(if ((get-in @entities [:state :inventory]) :wool)
|
||||
(actions/talk entities :ego "The sheep has given me enough wool.")
|
||||
(do (actions/give entities :wool)
|
||||
(actions/talk entities :ego "I guess her wool is shedding."))))
|
||||
(if (is-sheep-close? @entities)
|
||||
(do (actions/walk-to entities :ego ego-sheep-loc)
|
||||
(actions/give entities :wool)
|
||||
(actions/talk entities :ego "I guess her wool is shedding."))
|
||||
(actions/talk entities :ego "She's too far away for me to pet her."))))
|
||||
:scripts {:wool (actions/get-script entities
|
||||
(actions/talk entities :ego "She doesn't need it back."))
|
||||
:carrot (actions/get-script entities
|
||||
(actions/walk-to entities :ego [132 140])
|
||||
(actions/walk-to entities :ego ego-sheep-loc)
|
||||
(actions/talk entities :ego "Come on girl, get the carrot!")
|
||||
(actions/walk-straight-to entities :sheep [95 150]))
|
||||
:flask (actions/get-script entities
|
||||
(actions/give entities :flask-with-contents)
|
||||
(actions/talk entities :ego "Sheeps milk."))}
|
||||
(if (is-sheep-close? @entities)
|
||||
(do (actions/walk-to entities :ego ego-sheep-loc)
|
||||
(actions/give entities :flask-with-contents)
|
||||
(actions/talk entities :ego "Sheeps milk."))
|
||||
(actions/talk entities :ego "She's too far away.")))}
|
||||
:left {:walk (utils/flip sheep-walk)
|
||||
:stand (utils/flip sheep-stand)}
|
||||
:right {:walk sheep-walk
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
(update! screen :renderer (stage) :camera (orthographic))
|
||||
(let [_ (input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0)
|
||||
music (sound "town-music.mp3")
|
||||
_ (sound! music :loop 0.80)
|
||||
;; _ (sound! music :loop 0.80)
|
||||
rooms {:inside-house (rooms.inside-house/make screen)
|
||||
:outside-house (rooms.outside-house/make screen)
|
||||
:behind-house (rooms.behind-house/make screen)
|
||||
|
||||
Reference in New Issue
Block a user