multi bird

This commit is contained in:
2014-12-10 13:19:08 -08:00
parent e10c54f85b
commit 04bac2afb9
3 changed files with 29 additions and 22 deletions

View File

@@ -19,9 +19,6 @@
balloon-sheet (texture! (texture "outside-castle/balloons.png") :split 20 36)
balloon-stand (animation 0.25 (for [i [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 0 1 2 1 0 1 2 1 0 1 2 1 0 1 2]]
(aget balloon-sheet 0 i)))
bird-sheet (texture! (texture "outside-castle/bird.png") :split 1 2)
bird-stand (animation 0.15 (for [i [0 1]]
(aget bird-sheet 0 i)))
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])
steer-sheet (texture! (texture "outside-castle/steer.png") :split 50 35)
steer-stand (animation 0.2 (for [i [0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 2 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 3 3 3 3 3 0 0 0 0]]
@@ -166,22 +163,9 @@
:script (actions/get-script entities
(actions/talk entities :ego "Those look like the choicest of balloons.")))
:stand)
:bird (actions/start-animation screen
(assoc (animation->texture screen bird-stand)
:x 0
:y 0
:baseline 21
:stand bird-stand
:path (catmull-rom-spline (map #(apply vector-2* %) (as-> [[82 235] [134 215] [185 235] [165 238]
[220 225] [210 230] [250 235]] p
(concat p (reverse p)))) true)
:update-fn (fn [screen entities entity]
(let [speed 0.05
pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed)))
v (vector-2 0 0)
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))
:stand)
:bird (utils/make-bird screen (as-> [[82 235] [134 215] [185 235] [165 238]
[220 225] [210 230] [250 235]] p
(concat p (reverse p))))
:butterfly (assoc (animation->texture screen butterfly-stand)
:x 161
:y 218