diff --git a/desktop/resources/castle-gate/throw-walkie.png b/desktop/resources/castle-gate/throw-walkie.png new file mode 100644 index 00000000..50e84f01 Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.png differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/0.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/0.pxi new file mode 100644 index 00000000..8a18719e Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/0.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/1.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/1.pxi new file mode 100644 index 00000000..2c14ff10 Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/1.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/2.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/2.pxi new file mode 100644 index 00000000..364324e2 Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/2.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/3.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/3.pxi new file mode 100644 index 00000000..8906131e Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/3.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/4.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/4.pxi new file mode 100644 index 00000000..347741b1 Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/4.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/5.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/5.pxi new file mode 100644 index 00000000..915ffdd1 Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/5.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/6.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/6.pxi new file mode 100644 index 00000000..f9195b36 Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/6.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/7.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/7.pxi new file mode 100644 index 00000000..0af10c18 Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/7.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/8.pxi b/desktop/resources/castle-gate/throw-walkie.pxa/8.pxi new file mode 100644 index 00000000..f77268c2 Binary files /dev/null and b/desktop/resources/castle-gate/throw-walkie.pxa/8.pxi differ diff --git a/desktop/resources/castle-gate/throw-walkie.pxa/CelData.plist b/desktop/resources/castle-gate/throw-walkie.pxa/CelData.plist new file mode 100644 index 00000000..9088485c --- /dev/null +++ b/desktop/resources/castle-gate/throw-walkie.pxa/CelData.plist @@ -0,0 +1,42 @@ + + + + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + duration + 1 + + + diff --git a/desktop/src-common/advent/screens/rooms/castle_gate.clj b/desktop/src-common/advent/screens/rooms/castle_gate.clj index 39edefac..927fd9bf 100644 --- a/desktop/src-common/advent/screens/rooms/castle_gate.clj +++ b/desktop/src-common/advent/screens/rooms/castle_gate.clj @@ -120,40 +120,60 @@ (defn make [screen] - (rooms/make :music {:day :town-2 :night :night} - :interactions {:right-dir {:box [300 40 320 83] - :script (actions/get-script entities - (actions/walk-to entities :ego [301 46] :face :right) - (actions/walk-straight-to entities :ego [340 40]) - (actions/transition-background entities :outside-castle [82 180]) - (actions/walk-to entities :ego [129 148])) - :cursor :right} - :left-dir {:box [105 93 169 212] - :script (actions/get-script entities (attempt-walking-through-gate entities)) - :cursor :left} - :big-tree {:box [20 10 82 235] - :scripts {:walkie-talkies (actions/get-script entities (drop-walkie-talkie entities))}} - :window {:box [192 157 215 215] - :script (actions/get-script entities - (actions/do-dialogue entities :ego "It's a big window!")) - :scripts {:walkie-talkies (actions/get-script entities - (actions/walk-to entities :ego [285 71]) - (actions/walk-straight-to entities :ego [308 115] :face :left) - (actions/play-animation entities :ego :throw) - (actions/remove-item entities :walkie-talkies) - (actions/walk-straight-to entities :ego [285 71]))}}} - - :layers {:day [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)] - :night [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)]} - :entities {:frankie (make-frankie screen) - :goon-1 (make-goon-1 screen) - :goon-2 (make-goon-2 screen)} - - :collision "castle-gate/collision.png" - :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.30) - :apply-state (fn [entities] - (as-> entities entities - (if (= :night (get-in entities [:state :time])) - (make-night entities) - entities))) - :start-pos [300 45])) + (let [throw-walkie (utils/make-anim "castle-gate/throw-walkie.png" [205 136] 0.1 (flatten [(repeat 55 0) (range 9) (repeat 55 8)])) + walkie-base (animation 1.0 [(last (utils/split-texture "castle-gate/throw-walkie.png" [205 136] (range 9)))])] + (rooms/make :music {:day :town-2 :night :night} + :interactions {:right-dir {:box [300 40 320 83] + :script (actions/get-script entities + (actions/walk-to entities :ego [301 46] :face :right) + (actions/walk-straight-to entities :ego [340 40]) + (actions/transition-background entities :outside-castle [82 180]) + (actions/walk-to entities :ego [129 148])) + :cursor :right} + :left-dir {:box [105 93 169 212] + :script (actions/get-script entities (attempt-walking-through-gate entities)) + :cursor :left} + + :big-tree {:box [20 10 82 235] + :scripts {:walkie-talkies (actions/get-script entities (drop-walkie-talkie entities))}} + :window {:box [192 157 215 215] + :script (actions/get-script entities + (actions/walk-to entities :ego [285 71]) + (actions/walk-straight-to entities :ego [308 105] :face :left) + (actions/begin-animation entities :throw-walkie :throw-walkie) + (actions/play-animation entities :ego :throw) + (actions/begin-animation entities :throw-walkie :stand) + (Thread/sleep 2000) + (actions/walk-straight-to entities :ego [285 71])) + :scripts {:walkie-talkies (actions/get-script entities + (actions/walk-to entities :ego [285 71]) + (actions/walk-straight-to entities :ego [308 105] :face :left) + (actions/begin-animation entities :throw-walkie :throw-walkie) + (actions/play-animation entities :ego :throw) + (actions/remove-item entities :walkie-talkies) + (actions/begin-animation entities :throw-walkie :stand) + (Thread/sleep 2000) + (actions/walk-straight-to entities :ego [285 71]))}}} + + :layers {:day [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)] + :night [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)]} + :entities {:frankie (make-frankie screen) + :goon-1 (make-goon-1 screen) + :goon-2 (make-goon-2 screen) + :throw-walkie (assoc (animation->texture screen walkie-base) + :x 104 :y 88 + :baseline 130 + + :throw-walkie throw-walkie + :stand walkie-base + :anim-start 0 + :anim walkie-base)} + + :collision "castle-gate/collision.png" + :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.30) + :apply-state (fn [entities] + (as-> entities entities + (if (= :night (get-in entities [:state :time])) + (make-night entities) + entities))) + :start-pos [300 45]))) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 7ad913f7..8281684d 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -357,7 +357,7 @@ void main() glad (utils/make-anim "ego/glad.png" [20 46] 0.04 (flatten [0 1 2 3 4 (repeat 8 [5 5 5]) (repeat 20 0)])) milk (utils/make-anim "ego/squat.png" [18 36] 0.05 [0 1 2 2 3 3 3 3 3 3 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 3 3 3 3 3 3 3 3 3 3 3 2 1 0]) idea (utils/make-anim "ego/idea.png" [18 70] 0.3 [2 0 0 0 0 0 0 2]) - throw (utils/make-anim "ego/throw.png" [18 36] 0.04 (flatten [[(repeat 5 0) (repeat 10 1)] (repeat 3 [2 2 2 3 3 3 4 4 4 5 5 5]) (repeat 5 [2 2 3 3 4 4 5 5]) (repeat 10 [2 3 4 5]) [2 3 3] (repeat 15 6)])) + throw (utils/make-anim "ego/throw.png" [18 36] 0.04 (flatten [[(repeat 5 0) (repeat 10 1)] (repeat 3 [2 2 2 3 3 3 4 4 4 5 5 5]) (repeat 5 [2 2 3 3 4 4 5 5]) (repeat 10 [2 3 4 5]) [2 3 3] (repeat 33 6)])) swing-shovel (utils/make-anim "ego/swing-shovel.png" [70 70] 0.1 (range 9)) love (utils/make-anim "ego/love.png" [50 70] 0.1 (flatten [0 0 1 1 2 2 3 3 4 4 5 5 6 6 (repeat 10 7) (repeat 5 8) (repeat 5 7) (repeat 5 8) (repeat 5 7) (repeat 10 [23 24 25 24]) (repeat 30 9) 10 11 12 13 14 15 16 17 18 19 20 21 21 21 22 22 22 21 21 21 21 21 21 21 21 22 22 22 22 22 21 21 21 21 22 22 22 22 22 22 21 21 21 21 21 6 6 5 5 4 4 3 3 2 2 1 1 0])) axe (utils/make-anim "ego/axe.png" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 7)])) diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index ebd1e4a6..f4374ca9 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -117,10 +117,15 @@ (texture! frame :flip true false) frame)))) -(defn make-anim [file [w h] speed frames] +(defn split-texture [file [w h] frames] (let [sheet (texture! (texture file) :split w h)] - (animation speed (for [i frames] - (aget sheet 0 i))))) + (for [i frames] + (aget sheet 0 i)))) + +(defn make-anim [file [w h] speed frames] + (animation speed (split-texture file [w h] frames))) + + (defn make-bird [screen p] (let [bird-sheet (texture! (texture "outside-castle/bird.png") :split 1 2) bird-stand (animation 0.15 (for [i [0 1]]