closer to supporting toss.

This commit is contained in:
2015-05-07 21:26:07 -07:00
parent 983a4ac251
commit a791a85e35
14 changed files with 108 additions and 41 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
</array>
</plist>

View File

@@ -120,40 +120,60 @@
(defn make [screen] (defn make [screen]
(rooms/make :music {:day :town-2 :night :night} (let [throw-walkie (utils/make-anim "castle-gate/throw-walkie.png" [205 136] 0.1 (flatten [(repeat 55 0) (range 9) (repeat 55 8)]))
:interactions {:right-dir {:box [300 40 320 83] walkie-base (animation 1.0 [(last (utils/split-texture "castle-gate/throw-walkie.png" [205 136] (range 9)))])]
:script (actions/get-script entities (rooms/make :music {:day :town-2 :night :night}
(actions/walk-to entities :ego [301 46] :face :right) :interactions {:right-dir {:box [300 40 320 83]
(actions/walk-straight-to entities :ego [340 40]) :script (actions/get-script entities
(actions/transition-background entities :outside-castle [82 180]) (actions/walk-to entities :ego [301 46] :face :right)
(actions/walk-to entities :ego [129 148])) (actions/walk-straight-to entities :ego [340 40])
:cursor :right} (actions/transition-background entities :outside-castle [82 180])
:left-dir {:box [105 93 169 212] (actions/walk-to entities :ego [129 148]))
:script (actions/get-script entities (attempt-walking-through-gate entities)) :cursor :right}
:cursor :left} :left-dir {:box [105 93 169 212]
:big-tree {:box [20 10 82 235] :script (actions/get-script entities (attempt-walking-through-gate entities))
:scripts {:walkie-talkies (actions/get-script entities (drop-walkie-talkie entities))}} :cursor :left}
:window {:box [192 157 215 215]
:script (actions/get-script entities :big-tree {:box [20 10 82 235]
(actions/do-dialogue entities :ego "It's a big window!")) :scripts {:walkie-talkies (actions/get-script entities (drop-walkie-talkie entities))}}
:scripts {:walkie-talkies (actions/get-script entities :window {:box [192 157 215 215]
(actions/walk-to entities :ego [285 71]) :script (actions/get-script entities
(actions/walk-straight-to entities :ego [308 115] :face :left) (actions/walk-to entities :ego [285 71])
(actions/play-animation entities :ego :throw) (actions/walk-straight-to entities :ego [308 105] :face :left)
(actions/remove-item entities :walkie-talkies) (actions/begin-animation entities :throw-walkie :throw-walkie)
(actions/walk-straight-to entities :ego [285 71]))}}} (actions/play-animation entities :ego :throw)
(actions/begin-animation entities :throw-walkie :stand)
:layers {:day [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)] (Thread/sleep 2000)
:night [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)]} (actions/walk-straight-to entities :ego [285 71]))
:entities {:frankie (make-frankie screen) :scripts {:walkie-talkies (actions/get-script entities
:goon-1 (make-goon-1 screen) (actions/walk-to entities :ego [285 71])
:goon-2 (make-goon-2 screen)} (actions/walk-straight-to entities :ego [308 105] :face :left)
(actions/begin-animation entities :throw-walkie :throw-walkie)
:collision "castle-gate/collision.png" (actions/play-animation entities :ego :throw)
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.30) (actions/remove-item entities :walkie-talkies)
:apply-state (fn [entities] (actions/begin-animation entities :throw-walkie :stand)
(as-> entities entities (Thread/sleep 2000)
(if (= :night (get-in entities [:state :time])) (actions/walk-straight-to entities :ego [285 71]))}}}
(make-night entities)
entities))) :layers {:day [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)]
:start-pos [300 45])) :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])))

View File

@@ -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)])) 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]) 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]) 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)) 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])) 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)])) 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)]))

View File

@@ -117,10 +117,15 @@
(texture! frame :flip true false) (texture! frame :flip true false)
frame)))) frame))))
(defn make-anim [file [w h] speed frames] (defn split-texture [file [w h] frames]
(let [sheet (texture! (texture file) :split w h)] (let [sheet (texture! (texture file) :split w h)]
(animation speed (for [i frames] (for [i frames]
(aget sheet 0 i))))) (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] (defn make-bird [screen p]
(let [bird-sheet (texture! (texture "outside-castle/bird.png") :split 1 2) (let [bird-sheet (texture! (texture "outside-castle/bird.png") :split 1 2)
bird-stand (animation 0.15 (for [i [0 1]] bird-stand (animation 0.15 (for [i [0 1]]