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

View File

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