more grandma refinement.

This commit is contained in:
2014-12-13 10:35:48 -08:00
parent 3572a09227
commit cbc1497f74
16 changed files with 46 additions and 25 deletions

View File

@@ -72,7 +72,6 @@
(def medal {:name "Medal of strength" :value :medal :cursor :medal})
(def certificate {:name "Certificate of courage" :value :certificate :cursor :certificate})
(def items
@@ -108,6 +107,6 @@
:flask-1-with-cream-of-mushroom {:name "Flask with cream of mushrooms soup" :value :flask-1-with-cream-of-mushroom :cursor :flask-with-contents
:scripts {:slobber (make-strength-potion)}}
:medal {:name "Medal of strength" :value :medal :cursor :medal}
:certificate {:name "Certificate of courage" :value :certificate :cursor :certificate}
:kiss {:name "Kiss for courage" :value :kiss :cursor :kiss}
:sword {:name "Sword of Blergh" :value :sword :cursor :sword}
})

View File

@@ -9,7 +9,7 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn get-down [entities]
(actions/talk entities :ego "I'll get down.")
(actions/walk-straight-to entities :ego [151 50] :update-baseline? false :face :left)
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :blank)
@@ -23,9 +23,10 @@
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])]
grandma-squat-1 (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [3 4 5 5 5 5 5])
grandma-squat-2 (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [5 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])
grandma-kiss (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 8 9 10 9 10 9 10 9 8 0])]
(rooms/make :music :town-2
:interactions
{:down-dir {:box [150 0 270 20]
@@ -46,6 +47,7 @@
{:object nil :x 0 :y 0 :width 320 :height 240 :baseline 240
:script (actions/get-script entities
(when (get-in @entities [:room :entities :ladder])
(actions/talk entities :ego "I'll get down.")
(get-down entities)))}))
)}}
:grass {:box [26 105 60 160]
@@ -72,20 +74,27 @@
(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-first-half :stop? false)
(sound! (sound "cat-tree/cat.ogg") :play)
(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/play-animation entities :grandma :squat-1 :stop? false)
(actions/remove-entity entities :cat)
(actions/play-animation entities :grandma :squat-2)
(actions/do-dialogue entities :grandma "Thank you for rescuing my furry friend, young man!")
(get-down entities)
(actions/walk-straight-to entities :ego [165 45] :face :left)
(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))
:ego "It's no big deal."
:grandma "You won't go unrewarded!"
:grandma "Come here young man.")
(actions/walk-straight-to entities :ego [133 35])
(actions/talk entities :grandma "For your impressive display of courage and bravery, I give you this. ")
(sound! (sound "cat-tree/kiss.ogg") :play)
(actions/play-animation entities :grandma :kiss)
(actions/give entities :kiss)
(actions/play-animation entities :ego :get-sick :stop? false)
(actions/walk-straight-to entities :ego [165 45])
(actions/talk entities :ego "Ugh! Gross!"))
(actions/talk entities :ego "I guess I'm too far away.")))})
cat-stand)
:grandma (assoc (animation->texture screen grandma-stand)
@@ -93,9 +102,10 @@
:anim grandma-stand
:anim-start 0
:talk grandma-talk
:cat-stand grandma-cat-stand
:kiss grandma-kiss
:stand grandma-stand
:squat grandma-squat
:squat-1 grandma-squat-1
:squat-2 grandma-squat-2
:origin-x 12
:origin-y 0
:scale-x 1.45
@@ -104,7 +114,7 @@
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.20)
:apply-state (fn [entities]
(as-> entities entities
(if (actions/has-item? entities :certificate)
(if (actions/has-item? entities :kiss)
(update-in entities [:room :entities] #(dissoc % :cat))
entities)))
:start-pos [203 1])))

View File

@@ -106,7 +106,7 @@
(actions/talk entities :ego "I got it! I will become the greatest knight Remington has ever known!"))
(defn try-to-pull-sword [entities missing-items obtained-items]
(let [item->proof {:trophy "wisdom" :medal "strength" :certificate "courage"}]
(let [item->proof {:trophy "wisdom" :medal "strength" :kiss "courage"}]
(actions/play-animation entities :ego :reach)
(actions/do-dialogue entities
:ego "I can't pull it out!"
@@ -159,8 +159,8 @@
(do (actions/talk entities :ego "That's the coolest sword I've ever seen!!")
(actions/walk-to entities :ego [37 134] :face :left)
(actions/talk entities :ego "If I pull it out I can become a great knight!")
(let [missing-items (set/difference #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items]))
obtained-items (set/intersection #{:trophy :medal :certificate} (get-in @entities [:state :obtained-items]))]
(let [missing-items (set/difference #{:trophy :medal :kiss} (get-in @entities [:state :obtained-items]))
obtained-items (set/intersection #{:trophy :medal :kiss} (get-in @entities [:state :obtained-items]))]
(if (= #{} missing-items)
(pull-sword entities)
(try-to-pull-sword entities missing-items obtained-items)))))
@@ -203,9 +203,6 @@
:anim trophy
:anim-start 0
:script (actions/get-script entities
(actions/give entities :trophy)
(actions/give entities :certificate)
(actions/give entities :medal)
(walk-to-player entities)
(if (= nil (get-in @entities [:state :current-riddle]))
(let [{:keys [run choices]} (nice-trophy-dialogue entities)]

View File

@@ -122,6 +122,7 @@
grow (animation 0.1 (for [i [0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 3 0 0 0 0 3 0 0 0 3 3 0 0 0 2 2 0 0 2 0 0 2 0 2 0 2 0 2 0 2 0 2 3 2 3 2 3 2 3 2 4 3 4 3 4 3 4]]
(texture (aget grow-sheet 0 i))))
hold-up-to-window (utils/make-anim "ego/hold-up-to-window.png" [18 36] 0.1 [0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 1 0 0 0 0 0 0])
get-sick (animation 0.3 (map (partial get [(aget talk-sheet 0 0 ) (texture "ego/get-sick.png")]) [0 1 1 1 1 1 1 1 1 1 1 1]) )
ego {:right {:walk walk-right
:stand stand-anim
:talk talk-anim
@@ -133,6 +134,7 @@
:cat-toy-first-half cat-toy-first-half
:cat-toy-last-half cat-toy-last-half
:grow grow
:get-sick get-sick
:hold-up-to-window hold-up-to-window
[:fire 1] fire-1-anim
[:fire 2] fire-2-anim
@@ -145,6 +147,7 @@
:squat (utils/flip squat-anim)
:reach (utils/flip reach-anim)
:cat-toy (utils/flip cat-toy-anim)
:get-sick (utils/flip get-sick)
:cat-toy-first-half (utils/flip cat-toy-first-half)
:cat-toy-last-half (utils/flip cat-toy-last-half)
:grow (utils/flip grow)

View File

@@ -14,7 +14,7 @@
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
(println (:input-x screen) (:input-y screen) "->" x y)))
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :certificate :sword])
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword])
(defn cursor [filename which]
(let [scale 2