diff --git a/desktop/ready-for-magic-slingshot.edn b/desktop/ready-for-magic-slingshot.edn index fe34c5b2..0964a8b1 100644 --- a/desktop/ready-for-magic-slingshot.edn +++ b/desktop/ready-for-magic-slingshot.edn @@ -1 +1 @@ -{:active? true, :seen-frankie? true, :knows-about-stash? true, :convinced-wizard? true, :time :night, :broke-lock? true, :opened-bars? true, :inventory (:slingshot :trophy :medal :flask-1-strength :walkie-talkie :note-2 :spear :camera :note-1 :key :crowbar :ladder :grass :kiss :sword), :wizard-left? false, :dropped-ball? true, :hay-searches 4, :clues #{}, :stop? false, :warden-sleeping? true, :current-riddle :wool, :warden-fast-asleep? true, :last-room :outside-castle, :wants-toy true, :bent-bars? true, :chest-contents [], :mints-eaten 0, :object nil, :talked-to-owl? true, :obtained-items #{:money :flask-2 :key :slingshot :flies :rope :kiss :spear :medal :sword :magic-slingshot :flask-flies-ash :flask-1 :flask-1-strength :flask-water-flies :walkie-talkies :ash :grass :camera :sack-lunch :ladder :walkie-talkie :trophy :broken-clock :monocle :alarm-clock :crowbar :note-1 :flask-water :note-2 :ball-n-chain :feather :spell-component}} +{:active? true, :seen-intro? true, :seen-frankie? true, :knows-about-stash? true, :convinced-wizard? true, :time :night, :broke-lock? true, :opened-bars? true, :inventory (:slingshot :trophy :medal :flask-1-strength :walkie-talkie :note-2 :spear :camera :note-1 :key :crowbar :ladder :grass :kiss :sword), :wizard-left? false, :dropped-ball? true, :hay-searches 4, :clues #{}, :stop? false, :warden-sleeping? true, :current-riddle :wool, :warden-fast-asleep? true, :last-room :outside-castle, :wants-toy true, :bent-bars? true, :chest-contents [], :mints-eaten 0, :object nil, :talked-to-owl? true, :obtained-items #{:money :flask-2 :key :slingshot :flies :rope :kiss :spear :medal :sword :magic-slingshot :flask-flies-ash :flask-1 :flask-1-strength :flask-water-flies :walkie-talkies :ash :grass :camera :sack-lunch :ladder :walkie-talkie :trophy :broken-clock :monocle :alarm-clock :crowbar :note-1 :flask-water :note-2 :ball-n-chain :feather :spell-component}} diff --git a/desktop/ready-to-pull-sword.edn b/desktop/ready-to-pull-sword.edn index ca3f4bff..5fe20ff6 100644 --- a/desktop/ready-to-pull-sword.edn +++ b/desktop/ready-to-pull-sword.edn @@ -1 +1 @@ -{:active? true, :convinced-wizard? true, :inventory [:ladder :glass-eye :recipe :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy} :time :day} +{:active? true, :seen-intro? true :convinced-wizard? true, :inventory [:ladder :glass-eye :recipe :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy} :time :day} diff --git a/desktop/resources/dream/magic b/desktop/resources/dream/magic index 4b0bb994..3f4b7d1e 100644 --- a/desktop/resources/dream/magic +++ b/desktop/resources/dream/magic @@ -74,16 +74,16 @@ active: true lowMin: 0.0 lowMax: 0.0 highMin: 100.0 -highMax: 200.0 +highMax: 250.0 relative: false scalingCount: 3 scaling0: 1.0 -scaling1: 0.7755102 -scaling2: 0.36734694 +scaling1: 1.0 +scaling2: 0.1632653 timelineCount: 3 timeline0: 0.0 -timeline1: 0.45890412 -timeline2: 0.7808219 +timeline1: 0.46575344 +timeline2: 0.6917808 - Angle - active: true lowMin: 270.0 @@ -107,8 +107,8 @@ active: false active: true lowMin: -50.0 lowMax: -50.0 -highMin: -120.0 -highMax: -120.0 +highMin: -180.0 +highMax: -180.0 relative: false scalingCount: 2 scaling0: 0.0 @@ -160,7 +160,7 @@ scaling2: 0.75 scaling3: 0.0 timelineCount: 4 timeline0: 0.0 -timeline1: 0.2 +timeline1: 0.04109589 timeline2: 0.8 timeline3: 1.0 - Options - diff --git a/desktop/resources/ego/dot.png b/desktop/resources/ego/dot.png index 9b630c47..8802f8e0 100644 Binary files a/desktop/resources/ego/dot.png and b/desktop/resources/ego/dot.png differ diff --git a/desktop/resources/ego/glad-jump b/desktop/resources/ego/glad-jump new file mode 100644 index 00000000..72fcd09e --- /dev/null +++ b/desktop/resources/ego/glad-jump @@ -0,0 +1,163 @@ +Untitled +- Delay - +active: false +- Duration - +lowMin: 100.0 +lowMax: 100.0 +- Count - +min: 0 +max: 100 +- Emission - +lowMin: 0.0 +lowMax: 0.0 +highMin: 200.0 +highMax: 200.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life - +lowMin: 0.0 +lowMax: 0.0 +highMin: 800.0 +highMax: 800.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Life Offset - +active: false +- X Offset - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Y Offset - +active: true +lowMin: 0.0 +lowMax: 0.0 +highMin: 0.0 +highMax: 0.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Spawn Shape - +shape: square +- Spawn Width - +lowMin: 18.0 +lowMax: 18.0 +highMin: 10.0 +highMax: 10.0 +relative: false +scalingCount: 2 +scaling0: 0.0 +scaling1: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Spawn Height - +lowMin: 5.0 +lowMax: 5.0 +highMin: 20.0 +highMax: 20.0 +relative: false +scalingCount: 3 +scaling0: 0.0 +scaling1: 0.5714286 +scaling2: 0.6122449 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.5 +timeline2: 1.0 +- Scale - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 1 +scaling0: 1.0 +timelineCount: 1 +timeline0: 0.0 +- Velocity - +active: true +lowMin: 10.0 +lowMax: 3.0 +highMin: 40.0 +highMax: 30.0 +relative: false +scalingCount: 3 +scaling0: 1.0 +scaling1: 0.0 +scaling2: 0.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.15068494 +timeline2: 0.37671232 +- Angle - +active: true +lowMin: 220.0 +lowMax: 320.0 +highMin: 0.0 +highMax: 0.0 +relative: true +scalingCount: 3 +scaling0: 0.0 +scaling1: 1.0 +scaling2: 1.0 +timelineCount: 3 +timeline0: 0.0 +timeline1: 0.21232876 +timeline2: 1.0 +- Rotation - +active: false +- Wind - +active: false +- Gravity - +active: false +- Tint - +colorsCount: 6 +colors0: 0.5647059 +colors1: 0.7607843 +colors2: 1.0 +colors3: 0.34509805 +colors4: 0.8352941 +colors5: 1.0 +timelineCount: 2 +timeline0: 0.0 +timeline1: 1.0 +- Transparency - +lowMin: 0.0 +lowMax: 0.0 +highMin: 1.0 +highMax: 1.0 +relative: false +scalingCount: 4 +scaling0: 1.0 +scaling1: 1.0 +scaling2: 1.0 +scaling3: 0.0 +timelineCount: 4 +timeline0: 0.0 +timeline1: 0.05479452 +timeline2: 0.34246576 +timeline3: 1.0 +- Options - +attached: false +continuous: false +aligned: false +additive: true +behind: false +premultipliedAlpha: false +- Image Path - +/Users/bryce/dev/playground/advent/desktop/resources/dream/dot.png diff --git a/desktop/resources/ego/glad.png b/desktop/resources/ego/glad.png new file mode 100644 index 00000000..f4e1b089 Binary files /dev/null and b/desktop/resources/ego/glad.png differ diff --git a/desktop/resources/ego/glad.pxa/0.pxi b/desktop/resources/ego/glad.pxa/0.pxi new file mode 100644 index 00000000..50773413 Binary files /dev/null and b/desktop/resources/ego/glad.pxa/0.pxi differ diff --git a/desktop/resources/ego/glad.pxa/1.pxi b/desktop/resources/ego/glad.pxa/1.pxi new file mode 100644 index 00000000..27a86eb1 Binary files /dev/null and b/desktop/resources/ego/glad.pxa/1.pxi differ diff --git a/desktop/resources/ego/glad.pxa/2.pxi b/desktop/resources/ego/glad.pxa/2.pxi new file mode 100644 index 00000000..02d83850 Binary files /dev/null and b/desktop/resources/ego/glad.pxa/2.pxi differ diff --git a/desktop/resources/ego/glad.pxa/3.pxi b/desktop/resources/ego/glad.pxa/3.pxi new file mode 100644 index 00000000..5f377450 Binary files /dev/null and b/desktop/resources/ego/glad.pxa/3.pxi differ diff --git a/desktop/resources/ego/glad.pxa/4.pxi b/desktop/resources/ego/glad.pxa/4.pxi new file mode 100644 index 00000000..910ffd05 Binary files /dev/null and b/desktop/resources/ego/glad.pxa/4.pxi differ diff --git a/desktop/resources/ego/glad.pxa/5.pxi b/desktop/resources/ego/glad.pxa/5.pxi new file mode 100644 index 00000000..e0f86d7d Binary files /dev/null and b/desktop/resources/ego/glad.pxa/5.pxi differ diff --git a/desktop/resources/ego/glad.pxa/6.pxi b/desktop/resources/ego/glad.pxa/6.pxi new file mode 100644 index 00000000..4782ca3c Binary files /dev/null and b/desktop/resources/ego/glad.pxa/6.pxi differ diff --git a/desktop/resources/ego/glad.pxa/CelData.plist b/desktop/resources/ego/glad.pxa/CelData.plist new file mode 100644 index 00000000..4a0bd0e8 --- /dev/null +++ b/desktop/resources/ego/glad.pxa/CelData.plist @@ -0,0 +1,34 @@ + + + + + + duration + 2 + + + duration + 0.039999999105930328 + + + duration + 0.039999999105930328 + + + duration + 0.039999999105930328 + + + duration + 0.039999999105930328 + + + duration + 1 + + + duration + 1 + + + diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj index 260aa864..740370dc 100644 --- a/desktop/src-common/advent/screens/rooms/dream.clj +++ b/desktop/src-common/advent/screens/rooms/dream.clj @@ -153,14 +153,23 @@ :x 144 :y 122 :baseline 139 :script (actions/get-script entities (actions/walk-to entities :ego [168 76] :face :left) - (actions/do-dialogue entities :ego "Awesome! I'll take this sword and become a knight.") + (actions/talk entities :ego "There's a plaque here.") + (actions/play-animation entities :ego :squat) + (actions/do-dialogue entities + :ego "'A noble choice to be a knight,\nBe a hero, do what's right.'" + :ego "'There's no need to shove,\nTo find your true love,'" + :ego "'Because maidens love guys with might.'" + :ego "Awesome!" + :ego "If I become a knight, maybe Georgia McGorgeous will love me!") (actions/stop-walking entities :ego :face :right) (actions/do-dialogue entities - :fairy-godfather "Tick, I'm not sure that being a knight is right for you." - :fairy-godfather "I think you'd be better suited for a more menial job." - :ego "Hey! Why can't I be a knight! It's my destiny!" - :ego "And plus, knights get all the chicks!" - :ego "And this plaque here says that chicks dig knights."))) + :fairy-godfather "Tick, I told you that you can't be a knight." + :fairy-godfather "I think you'd be much better suited for a more menial job." + :ego "Hey! Why can't I be a knight? It's my destiny!" + :ego "And plus, it's the only way to get Georgia McGorgeous to love me!" + :ego "And this plaque here says that maidens love knights." + :fairy-godfather "As long as you're under my watch, Tick, I forbid it!" + :fairy-godfather "And you're just not cut out for it!"))) :broom (assoc (texture "dream/broom.png") :x 286 :y 122 :path (catmull-rom-spline (map #(apply vector-2* %) [[286 122] [286 128]]) true) @@ -168,7 +177,14 @@ :baseline 240 :script (actions/get-script entities (actions/walk-to entities :ego [267 70] :face :right) - (actions/talk entities :ego "So do I kill ghouls with this broom?") + (actions/talk entities :ego "There's a plaque here.") + (actions/play-animation entities :ego :squat) + (actions/do-dialogue entities + :ego "'Grab the broom, and sweep that dirt!\nSweep, and mop till your arms hurt.'" + :ego "'You'll smell like a hog,\nwith stench like a fog,'" + :ego "'So with you, no girl will flirt.'") + (actions/play-animation entities :ego :sigh) + (actions/talk entities :ego "So can I at least slay ghouls with this broom?") (actions/stop-walking entities :ego :face :left) (actions/do-dialogue entities :fairy-godfather "Not quite, young Tick." :fairy-godfather "This weapon is used to fight a more persistent foe." @@ -182,11 +198,17 @@ :baseline 240 :script (actions/get-script entities (actions/walk-to entities :ego [61 72] :face :left) - (actions/talk entities :ego "A shovel?") - (actions/stop-walking entities :ego :face :right) - (actions/do-dialogue entities :fairy-godfather "That's right, young Tick!" - :fairy-godfather "A grave-digger is a noble profession!" - :fairy-godfather "Take the shovel, and cast it into the pit of fate."))) + (actions/talk entities :ego "There's a plaque here.") + (actions/play-animation entities :ego :squat) + (actions/do-dialogue entities + :ego "'Choose the shovel, dig some holes,\ntis the boringest of roles,'" + :ego "'You can work by night,\nBut suffer a plight:'" + :ego "'Gals dislike guys who bury souls.'") + (actions/play-animation entities :ego :sigh) + (actions/do-dialogue entities + :fairy-godfather "Don't be dismayed, young Tick." + :fairy-godfather "Remember, these destinies can't be mistaken." + :ego "But it sounds so dull!"))) :sign (assoc (texture "dream/sign.png") :x 229 :y 33 :baseline 207) :fairy-godfather (assoc (animation->texture screen fairy-godfather-anim) :x 200 :y 130 diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 80842949..15cef355 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -5,6 +5,7 @@ [advent.screens.rooms.outside-castle :as outside-castle] [advent.screens.rooms.inside-castle :as inside-castle] [advent.actions :as actions] + [advent.tween :as tween] [advent.utils :as utils] [clojure.zip :as zip] [play-clj.core :refer :all] @@ -256,6 +257,78 @@ (assoc-in entities [:room :entities :lamb :target-x] (rand-nth [30 10 60 70])) entities))) + +(defn glad [entities] + (actions/run-action entities + (begin [this screen entities] + (let [current-y (get-in entities [:room :entities :ego :y]) + to-y (+ current-y 15)] + (-> entities + (update-in [:room :entities :ego] #(actions/start-animation screen % :glad) ) + (assoc-in [:tweens :jump] (tween/tween :jump screen [:room :entities :ego :y] current-y to-y 0.3 :ease tween/ease-out-cubic)) + (assoc-in [:room :entities :glad-jump] (doto (assoc (particle-effect "ego/glad-jump") + :x (get-in entities [:room :entities :ego :x]) + :y (get-in entities [:room :entities :ego :y]) + :baseline (get-in entities [:room :entities :ego :baseline])) + (particle-effect! :reset) (particle-effect! :start))) + (assoc-in [:room :entities :cloud] (assoc (texture "space/cloud.png") + :x (get-in entities [:room :entities :ego :x]) + :y (get-in entities [:room :entities :ego :y]) + :origin-x 7 + :origin-y 7 + :scale-x 0.5 + :scale-y 0.5 + :opacity 0.5 + :baseline 240)) + (assoc-in [:tweens :cloud-up] (tween/tween :cloud-up screen [:room :entities :cloud :y] + (get-in entities [:room :entities :ego :y]) + (+ (get-in entities [:room :entities :ego :y]) 10) + 1.0)) + (assoc-in [:tweens :cloud-fade] (tween/tween :cloud-fade screen [:room :entities :cloud :opacity] + 0.5 + 0.0 + 1.0)) + (assoc-in [:tweens :cloud-grow] (tween/tween :cloud-grow screen [:room :entities :cloud :scale-y] + 0.5 + 1.0 + 1.0)) + (assoc-in [:tweens :cloud-grow-2] (tween/tween :cloud-grow-2 screen [:room :entities :cloud :scale-x] + 0.5 + 1.0 + 1.0))))) + + (continue [this screen entities] + (assoc-in entities [:room :entities :glad-jump :y] (+ (get-in entities [:room :entities :ego :y]) 5)) + ) + + (done? [this screen entities] + (nil? (get-in entities [:tweens :jump]))) + + (terminate [this screen entities] + entities) + (can-skip? [this screen entities] + false)) + (Thread/sleep 800) + (actions/run-action entities + (begin [this screen entities] + (let [current-y (get-in entities [:room :entities :ego :y]) + to-y (- current-y 15)] + (-> entities + (assoc-in [:tweens :jump] (tween/tween :jump screen [:room :entities :ego :y] current-y to-y 0.3 :ease tween/ease-in-cubic))))) + + (continue [this screen entities] entities) + + (done? [this screen entities] + (and (nil? (get-in entities [:tweens :jump])) + (animation! (actions/find-animation (get-in entities [:room :entities :ego ]) :glad) + :is-animation-finished + (- (:total-time screen) (get-in entities [:room :entities :ego :anim-start]))))) + + (terminate [this screen entities] + entities) + (can-skip? [this screen entities] + false))) + (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) @@ -339,7 +412,8 @@ (actions/talk entities :ego "I guess her wool is shedding.")) (do (actions/talk entities :ego "Come here mama sheep!") - (actions/play-animation entities :ego :sigh) + (glad entities) + (actions/talk entities :ego "She's too far away for me to pet her."))))) :scripts #(condp = % :wool (actions/get-script entities diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index da833b38..51ffd062 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -197,6 +197,7 @@ scared-talk (utils/make-anim "ego/scared.png" [18 36] 0.05 [0 1 0 1 0 1 0 1 2 3 2 3 2 3 2 3]) scared-walk (utils/make-anim "ego/scared-walk.png" [16 36] 0.05 (range 6)) sigh (utils/make-anim "ego/sigh.png" [18 36] 0.08 [0 0 0 0 1 1 1 2 3 4 5 6 7 8 8 8 8 8 8 8 8 8 0 0 0 0 ]) + glad (utils/make-anim "ego/glad.png" [20 46] 0.04 (flatten [0 1 2 3 4 (repeat 10 [5 5 6]) (repeat 20 0)])) ego {:right {:walk walk-right :stand stand-anim @@ -231,7 +232,8 @@ :scared scared :scared-talk scared-talk :scared-walk scared-walk - :sigh sigh} + :sigh sigh + :glad glad} :left {:walk (utils/flip walk-right) :stand (utils/flip stand-anim) :talk (utils/flip talk-anim) @@ -256,7 +258,8 @@ [:fire 3] (utils/flip fire-3-anim) :spear (utils/flip spear) :pant (utils/flip pant) - :sigh (utils/flip sigh)} + :sigh (utils/flip sigh) + :glad (utils/flip glad)} :baseline (- 240 (last start-pos)) :facing :right :origin-x 9 diff --git a/desktop/src-common/advent/tween.clj b/desktop/src-common/advent/tween.clj index e950293a..312ab24a 100644 --- a/desktop/src-common/advent/tween.clj +++ b/desktop/src-common/advent/tween.clj @@ -35,6 +35,14 @@ (- (* t t t t) 2)) start))))) +(defn ease-out-quadratic [t start delta duration] + (let [t (/ t duration)] + (+ (* (- delta) t (- t 2)) start))) + +(defn ease-out-cubic [t start delta duration] + (let [t (dec (/ t duration))] + (+ (* delta (inc (* t t t))) start))) + (defn tween [id screen path start end duration & {:keys [finish ease]}] (let [ease (or ease ease-linear) finish (or finish identity)