more tweaks for wizard.

This commit is contained in:
2014-12-17 17:31:09 -08:00
parent 5432273f57
commit c1eab513b1
2 changed files with 11 additions and 3 deletions

View File

@@ -4,10 +4,10 @@
(defn make-entity [id entity]
(merge entity
{:mouse-in? (fn [entities x y]
(let [{entity-x :x entity-y :y width :width height :height region :object} (get-in entities [:room :entities id])
(let [{entity-x :x entity-y :y width :width scale-x :scale-x scale-y :scale-y height :height region :object} (get-in entities [:room :entities id])
width (or width (.getRegionWidth region))
height (or height (.getRegionHeight region))]
((zone/box entity-x entity-y (+ entity-x width) (+ entity-y height)) x y)))}
((zone/box entity-x entity-y (+ entity-x (* width (or 1 scale-x))) (+ entity-y (* height (or scale-y 1)))) x y)))}
(when (:script entity)
{:get-script (fn [cursor [x y]]
(if (= :main cursor)

View File

@@ -124,7 +124,15 @@
(if (get-in @entities [:room :entities :wizard])
(actions/talk entities :wizard "Don't touch my MagiSafe!!")
(open-safe entities)))}
}
:knight {:box [71 70 102 190]
:script (actions/get-script entities
(actions/talk entities :ego "Maybe when I am an older knight, Gandarf will give me his armor!"))}
:shelves {:box [215 100 320 220]
:script (actions/get-script entities
(actions/talk entities :ego "His shelves are full of books and strange ingredients."))}
:window {:box [119 120 203 190]
:script (actions/get-script entities
(actions/talk entities :ego "It's a really big window!"))}}
:layers [(assoc (texture "inside-house/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-house/desk.png") :x 0 :y 0 :baseline 200)
(assoc (texture "inside-house/sillhoute.png") :x 0 :y 0 :baseline 240)]