From 61e0b88b9f1c31cf36ca939823f584031921f6cd Mon Sep 17 00:00:00 2001 From: Remington Covert Date: Sun, 22 Feb 2015 09:46:42 -0800 Subject: [PATCH] better sheep. --- .../advent/screens/rooms/outside_house.clj | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 1b5e3562..4a9e9d24 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -227,17 +227,29 @@ add-wizard-if-necessary add-note-if-necessary)) +(defn jump-around [screen entities] + (when (and (not (get-in entities [:actions :script-running?])) + (get-in entities [:state :active?])) + (let [x (rand-nth [30 10 60 70])] + ((actions/get-script entities (actions/walk-straight-to entities :lamb [x 130]) :update-baseline? false) entities))) + nil) + (defn make [screen] (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) + lamb-walk-sheet (texture! (texture "outsidehouse/lamb-walk.png") :split 27 28) 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.05 (for [i (range 6)] (aget sheep-walk-sheet 0 i))) butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1]) cauldron (utils/make-anim "outsidehouse/cauldron.png" [50 38] 0.15 (range 4)) - scaler (utils/scaler-fn-with-baseline 110 0.10 1.00)] + scaler (utils/scaler-fn-with-baseline 110 0.10 1.00) + lamb-stand (aget lamb-walk-sheet 0 0) + lamb-walk (animation 0.05 (for [i (range 4)] + (aget lamb-walk-sheet 0 i)))] (rooms/make :music {:day :town-2 :night :night} + :timers {:jump-around [1.0 2.0 jump-around]} :interactions {:door {:box [258 100 281 160] :script @@ -272,9 +284,7 @@ :left-dir {:box [0 40 20 140] :script (actions/get-script entities - (walk-to-castle entities) - - ) + (walk-to-castle entities)) :cursor :left}} :layers {:day [(assoc (texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0) (assoc (texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122) @@ -337,9 +347,17 @@ :stand (utils/flip sheep-stand)} :right {:walk sheep-walk :stand sheep-stand} - :scaled true - ) + :scaled true) sheep-stand) + :lamb (assoc (texture "outsidehouse/lamb.png") + :x 10 :y 130 :baseline 90 + :right {:stand (animation 0.1 [lamb-stand]) + :walk lamb-walk} + + :left {:stand (utils/flip (animation 0.1 [lamb-stand])) + :walk (utils/flip lamb-walk)} + :scale-x (scaler [10 150]) + :scale-y (scaler [10 150])) :butterfly (assoc (animation->texture screen butterfly-stand) :x 161 :y 218