progress on interacting with player.

This commit is contained in:
2014-11-14 13:13:21 -08:00
parent 15fdefe984
commit 3fb29d463e

View File

@@ -135,15 +135,29 @@
:origin-y 0
:scaled true
#_:mouse-in? #_(fn [entities x y]
(let [{entity-x :x entity-y :y region :object} (get-in entities [:room :entities :ego])
width (.getRegionWidth region)
height (.getRegionHeight region)]
:mouse-in? (fn [entities x y]
(let [{entity-x :x entity-y :y region :object scale :scale-x} (get-in entities [:room :entities :ego])
half-width (/ (* (.getRegionWidth region) (or scale 1.0)) 2)
height (* (.getRegionHeight region) (or scale 1.0))]
#_(clojure.pprint/pprint [["point" x y]
["entity " (- entity-x half-width) entity-y (+ entity-x half-width) (+ entity-y height)]])
((zone/box entity-x entity-y (+ entity-x width) (+ entity-y height)) x y)))
#_:get-script #_(fn [cursor [x y]]
(case cursor
items/flask-with-cream-of-mushroom (actions/get-script entities (actions/talk entities :ego "Yuck. I filled it with backwash."))))
((zone/box (- entity-x half-width) entity-y (+ entity-x half-width) (+ entity-y height)) x y)))
:get-script (fn [cursor [x y]]
(condp = cursor
items/flask-1-with-cream-of-mushroom (actions/get-script entities (actions/talk entities :ego "My muscles have doubled in size!"))
items/recipe (actions/get-script entities (actions/do-dialogue entities
:ego "The recipe says:"
:ego "'For strength beyond measure,'"
:ego "'you must mix, at your leisure,'"
:ego "'1. Cream of mushroom soup.'"
:ego "'2. Saliva of the creature whose strength you want to match.'"
:ego "'3. Heat over flame.'"
:ego "'A word of warning, before you go.'"
:ego "'A sip is all it takes to grow.'"
:ego "'Not more than that do drink,'"
:ego "'Or you'll push your body to the brink.'"))
nil))
:x 150 :y 95
:id "ego"}]
(actions/start-animation screen
@@ -205,7 +219,7 @@
:inside-fangald (make-music "inside-fangald.ogg")}
:state {:object nil
:active? true
:inventory []
:inventory [items/flask-1-with-cream-of-mushroom items/recipe]
:clues #{}
:mints-eaten 0}
:actions {:object nil