This commit is contained in:
2014-12-11 21:23:08 -08:00
parent 53b7efb6a4
commit 3572a09227
16 changed files with 80 additions and 5 deletions

View File

@@ -89,7 +89,7 @@
~@forms))
(reset! ~entities (<!! c#)))))
(defn walk-straight-to [entities target-id [final-x final-y] & {:keys [update-baseline? face]}]
(defn walk-straight-to [entities target-id [final-x final-y] & {:keys [update-baseline? face speed]}]
(let [{start-x :x start-y :y} (get-in @entities [:room :entities target-id])
final-x (int final-x)
final-y (int final-y)
@@ -103,7 +103,7 @@
(let [delta-x (- final-x from-x)
delta-y (- final-y from-y)
distance (utils/dist from-x from-y final-x final-y)
speed (* (or scale-x 1.0) 1.5)
speed (* (or scale-x 1.0) (or speed 1.5))
moved-x (if (= 0.0 distance)
0
(* speed (/ delta-x distance)))

View File

@@ -20,7 +20,12 @@
(let [cat-stand-sheet (texture! (texture "cat-tree/cat-stand.png") :split 22 10)
cat-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0])]
(aget cat-stand-sheet 0 i)))
ladder-entity (assoc (texture "inside-cafeteria/ladder.png") :x 120 :y 60 :baseline 162)]
cat-walk (animation 0.2 [(texture "cat-tree/pounce.png")])
ladder-entity (assoc (texture "inside-cafeteria/ladder.png") :x 120 :y 60 :baseline 162)
grandma-stand (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
grandma-cat-stand (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [6 6 6 6 6 6 6 6 6 6 6 6 6 6 7])
grandma-squat (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [3 4 5 4 3])
grandma-talk (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 2 0 2 0 2 0 2 0 2 0 1 0 2 0 0])]
(rooms/make :music :town-2
:interactions
{:down-dir {:box [150 0 270 20]
@@ -57,6 +62,8 @@
:entities {:cat (actions/start-animation screen
(assoc (animation->texture screen cat-stand)
:x 184 :y 173 :baseline 1000
:walk cat-walk
:stand cat-stand
:script (actions/get-script entities
(actions/talk entities :ego "Here kitty, kitty, kitty.")
(actions/talk entities :ego "Kitty's not so interested in me."))
@@ -64,13 +71,35 @@
(actions/play-animation entities :ego :cat-toy)
(if (get-in @entities [:room :entities :ladder])
(do (actions/talk entities :ego "I think he's going for it!")
(actions/play-animation entities :ego :cat-toy)
(actions/play-animation entities :ego :cat-toy-first-half :stop? false)
(actions/walk-straight-to entities :cat [138 40] :update-baseline? false :speed 3)
(actions/play-animation entities :ego :cat-toy-last-half)
(swap! entities #(assoc-in % [:room :entities :grandma :stand]
(get-in % [:room :entities :grandma :cat-stand])))
(actions/play-animation entities :grandma :squat)
(actions/remove-entity entities :cat)
(get-down entities)
(actions/do-dialogue entities
:grandma "Thank you for rescuing my furry friend, young man!"
:ego "It's nothing."
:grandma "You are so brave!"
:grandma "Here's a certificate of bravery!")
(actions/talk entities :ego "TODO: get award from little old lady in this room")
(actions/give entities :certificate))
(actions/talk entities :ego "I guess I'm too far away.")))})
cat-stand)}
cat-stand)
:grandma (assoc (animation->texture screen grandma-stand)
:x 130 :y 37 :baseline 200
:anim grandma-stand
:anim-start 0
:talk grandma-talk
:cat-stand grandma-cat-stand
:stand grandma-stand
:squat grandma-squat
:origin-x 12
:origin-y 0
:scale-x 1.45
:scale-y 1.45)}
:collision "cat-tree/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.20)
:apply-state (fn [entities]

View File

@@ -109,6 +109,10 @@
(texture (aget reach-sheet 0 i))))
cat-toy-anim (animation 0.1 (for [i [0 0 1 1 2 2 3 4 3 2 3 4 3 2 3 4 3 2 3 4 3 2 2 1 1 0 0]]
(texture (aget cat-toy-sheet 0 i))))
cat-toy-first-half (animation 0.1 (for [i [0 0 1 1 2 2 3]]
(texture (aget cat-toy-sheet 0 i))))
cat-toy-last-half (animation 0.1 (for [i [3 3 3 2 1 1 0 0]]
(texture (aget cat-toy-sheet 0 i))))
fire-1-anim (animation 0.1 (for [i [0 1 2 2 2 3 2 3 2 2 2 1 0]]
(texture (aget fire-sheet 0 i))))
fire-2-anim (animation 0.1 (for [i [0 1 2 2 2 2 3 2 3 2 2 2 4 5 6 7 2 2 2 2 2 2 2 2 1 0]]
@@ -126,6 +130,8 @@
:end-squat end-squat
:reach reach-anim
:cat-toy cat-toy-anim
:cat-toy-first-half cat-toy-first-half
:cat-toy-last-half cat-toy-last-half
:grow grow
:hold-up-to-window hold-up-to-window
[:fire 1] fire-1-anim
@@ -139,6 +145,8 @@
:squat (utils/flip squat-anim)
:reach (utils/flip reach-anim)
:cat-toy (utils/flip cat-toy-anim)
:cat-toy-first-half (utils/flip cat-toy-first-half)
:cat-toy-last-half (utils/flip cat-toy-last-half)
:grow (utils/flip grow)
:hold-up-to-window (utils/flip hold-up-to-window)
[:fire 1] (utils/flip fire-1-anim)