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,6 +120,8 @@
(defn make [screen] (defn make [screen]
(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} (rooms/make :music {:day :town-2 :night :night}
:interactions {:right-dir {:box [300 40 320 83] :interactions {:right-dir {:box [300 40 320 83]
:script (actions/get-script entities :script (actions/get-script entities
@@ -131,23 +133,41 @@
:left-dir {:box [105 93 169 212] :left-dir {:box [105 93 169 212]
:script (actions/get-script entities (attempt-walking-through-gate entities)) :script (actions/get-script entities (attempt-walking-through-gate entities))
:cursor :left} :cursor :left}
:big-tree {:box [20 10 82 235] :big-tree {:box [20 10 82 235]
:scripts {:walkie-talkies (actions/get-script entities (drop-walkie-talkie entities))}} :scripts {:walkie-talkies (actions/get-script entities (drop-walkie-talkie entities))}}
:window {:box [192 157 215 215] :window {:box [192 157 215 215]
:script (actions/get-script entities :script (actions/get-script entities
(actions/do-dialogue entities :ego "It's a big window!")) (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 :scripts {:walkie-talkies (actions/get-script entities
(actions/walk-to entities :ego [285 71]) (actions/walk-to entities :ego [285 71])
(actions/walk-straight-to entities :ego [308 115] :face :left) (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/play-animation entities :ego :throw)
(actions/remove-item entities :walkie-talkies) (actions/remove-item entities :walkie-talkies)
(actions/begin-animation entities :throw-walkie :stand)
(Thread/sleep 2000)
(actions/walk-straight-to entities :ego [285 71]))}}} (actions/walk-straight-to entities :ego [285 71]))}}}
:layers {:day [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)] :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)]} :night [(assoc (texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)]}
:entities {:frankie (make-frankie screen) :entities {:frankie (make-frankie screen)
:goon-1 (make-goon-1 screen) :goon-1 (make-goon-1 screen)
:goon-2 (make-goon-2 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" :collision "castle-gate/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.30) :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.30)
@@ -156,4 +176,4 @@
(if (= :night (get-in entities [:state :time])) (if (= :night (get-in entities [:state :time]))
(make-night entities) (make-night entities)
entities))) entities)))
:start-pos [300 45])) :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]]