This commit is contained in:
=
2014-09-08 07:12:43 -07:00
parent 91d03855d5
commit 02538a8c05
3 changed files with 46 additions and 37 deletions

View File

@@ -99,48 +99,40 @@
]
{
:cursor {:id "cursor" :cursor-index 0 }
:background (assoc background
:id "background" :x 0 :y 0
:background (assoc {}
:collision (advent.pathfind/map-from-resource "pathfind-test-big.png")
:baseline 0
:mouse-overrides [{:mouse-in? (zone/box 290 131 320 224)
:mouse-overrides [{:mouse-in? (zone/box 300 131 320 224)
:cursor-override 4
:go-to [319 160]}
{:mouse-in? (zone/box 60 180 224 240)
:cursor-override 7
:go-to [137 204]}
{:mouse-in? (zone/box 0 40 30 140)
{:mouse-in? (zone/box 0 40 20 140)
:cursor-override 6
:go-to [0 80]}]
:interactions [{:mouse-in? (zone/box 258 100 281 160)
:click-fn (fn [screen entities [x y]]
(assoc-in entities [:ego :actions] [(fn [screen entities]
(run! talking-screen :on-talk :text "It's the door to Merlin's house."
:x (get-in entities [:ego :x]) :y (+ (get-in entities [:ego :y]) 25) )
(-> entities
(update-in [:ego :actions] rest)))]))}]
:scale-fn (scaler-fn-with-baseline 110 0.10 1.00))
:house (assoc house
:x 0 :y 0
:baseline 122)
:overdirt (assoc overdirt
:x 0 :y 0
:baseline 240)
:background-trees (assoc background-trees
:x 0 :y 0
:baseline 44)
(assoc-in entities [:ego :actions] [(actions/stop :ego)
(actions/talk :ego "Looking at the house.")]))}]
:scale-fn (scaler-fn-with-baseline 110 0.10 1.00)
:layers [(assoc background :x 0 :y 0 :baseline 0)
(assoc house :x 0 :y 0 :baseline 122)
(assoc overdirt :x 0 :y 0 :baseline 240)
(assoc background-trees :x 0 :y 0 :baseline 44)])
:ego (get-ego screen)
:fps (assoc (label "0" (color :white) ) :x 5 :baseline 9000)
}))
:on-render
(fn [screen [entities]]
(clear!)
(let [entities (update-ego screen entities (:ego entities))
_ (label! (:fps entities) :set-text (str (game :fps)))
entities (if (get-in entities [:ego :anim])
(update-in entities [:ego] #(merge % (animation->texture screen (:anim %))))
entities)]
(render! screen (sort-by :baseline (vals entities)))
(render! screen (sort-by :baseline (concat (vals entities) (get-in entities [:background :layers]))))
entities))
:on-resize (fn [screen entities]