added sheep animations.

This commit is contained in:
2014-10-04 11:34:12 -07:00
parent 1b487edc2b
commit 64cb52060e
9 changed files with 43 additions and 6 deletions

View File

@@ -101,9 +101,12 @@
(actions/respond entities % :wizard "Now scram!")
(actions/transition-background entities :outside-house [262 88]))}]}))
(defn make [screen]
(let [sheep-sheet (texture! (texture "outsidehouse/sheep-anim.png") :split 33 21)
sheep (animation 0.15 (for [i (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 9 10 (repeat 25 11) (repeat 15 12)])]
(aget sheep-sheet 0 i)))]
(let [sheep-stand-sheet (texture! (texture "outsidehouse/sheep-anim.png") :split 33 21)
sheep-walk-sheet (texture! (texture "outsidehouse/sheep-walk.png") :split 33 21)
sheep-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 9 10 (repeat 25 11) (repeat 15 12)])]
(aget sheep-stand-sheet 0 i)))
sheep-walk (animation 0.15 (for [i (range 6)]
(aget sheep-walk-sheet 0 i)))]
(rooms/make :interactions
{:door {:box [258 100 281 160]
:script (actions/get-script
@@ -144,7 +147,7 @@
(assoc (texture "overdirt.png") :x 0 :y 0 :baseline 240)
(assoc (texture "background-trees.png") :x 0 :y 0 :baseline 44)]
:entities {:sheep (actions/start-animation screen
(assoc (animation->texture screen sheep) :x 38 :y 160 :baseline 160
(assoc (animation->texture screen sheep-stand) :x 38 :y 160 :baseline 160
:box [38 160 71 181]
:script (actions/get-script
entities
@@ -157,7 +160,11 @@
:carrot (actions/get-script entities
(actions/walk-to entities :ego [132 140])
(actions/talk entities :ego "Come on girl, get the carrot!")
(actions/walk-straight-to entities :sheep [100 150]))})
sheep)}
(actions/walk-straight-to entities :sheep [95 150]))}
:left {:walk (utils/flip sheep-walk)
:stand (utils/flip sheep-stand)}
:right {:walk sheep-walk
:stand sheep-stand})
sheep-stand)}
:collision "outsidehouse/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00))))