This commit is contained in:
2015-04-29 19:20:14 -07:00
21 changed files with 101 additions and 62 deletions

View File

@@ -104,9 +104,10 @@
target-zoom)
target-x (bound-to-camera x 320 target-zoom)
target-y (bound-to-camera y 240 target-zoom)]
(if (or (not= target-x (get-in entities [:cam :x]))
(not= target-y (get-in entities [:cam :y]))
(not= target-zoom (get-in entities [:cam :zoom])))
(if (and (or (not= target-x (get-in entities [:cam :x]))
(not= target-y (get-in entities [:cam :y]))
(not= target-zoom (get-in entities [:cam :zoom])))
(not (get-in entities [:cam :paused?])))
(-> entities
(assoc-in [:tweens :cam-zoom]
(tween/tween :cam-zoom screen
@@ -625,10 +626,14 @@
(assoc-in e [:room :entities :ego] ego)
(assoc-in e [:state :last-room] new-background)
(assoc-in e [:tweens :fade-in] (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 time))
(update-in e [:tweens] dissoc :cam-zoom :cam-x :cam-y)
(assoc-in e [:cam :x] 160)
(assoc-in e [:cam :y] 120)
(assoc-in e [:cam :zoom] 0.95)
(if-not (get-in entities [:cam :paused?])
(-> e
(update-in [:tweens] dissoc :cam-zoom :cam-x :cam-y)
(assoc-in [:cam :x] 160)
(assoc-in [:cam :y] 120)
(assoc-in [:cam :zoom] 0.95))
e)
(if music-changed?
(assoc-in e [:tweens :fade-in-music] (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 time))
e))

View File

@@ -129,7 +129,16 @@
: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))}}}
:scripts {:walkie-talkies (actions/get-script entities (drop-walkie-talkie entities))}}
:window {:box [190 176 206 211]
: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)]}

View File

@@ -231,6 +231,7 @@
(actions/do-dialogue entities :ego "These are all really strange devices.")
(actions/play-animation entities :ego :squat)
(actions/give entities :walkie-talkies)
(actions/talk entities :ego "Tin cans connected with string?")
(actions/do-dialogue entities :ego "I wonder what all of these magic devices do.")))}
:grass {:box [26 105 60 160]
:script (actions/get-script entities

View File

@@ -87,14 +87,4 @@
(actions/talk entities :ego "Am I right boys?" :animate? false :stop? false))
(defn listen-to-frankie [entities]
(if (get-in @entities [:room :entities :frankie])
(do
(actions/play-animation entities :ego :reach-up :stop? false)
(Thread/sleep 1000)
(actions/play-animation entities :ego :reach-down :stop? false)
(actions/talk entities :ego "I don't hear anything in it."))
(do
(actions/talk entities :ego "I'll just give it a listen.")
(actions/play-animation entities :ego :reach-up :stop? false)
((rand-nth [listen-1 listen-2 listen-3]) entities)
(actions/play-animation entities :ego :reach-down))))
((rand-nth [listen-1 listen-2 listen-3]) entities))

View File

@@ -28,6 +28,7 @@
(assoc-in [:room :layers 5 :opacity] opacity)
(assoc-in [:room :layers 6 :opacity] opacity)
(assoc-in [:room :entities :sword :opacity] tool-opacity)
(assoc-in [:room :entities :case :opacity] tool-opacity)
(assoc-in [:room :entities :broom :opacity] tool-opacity)
(assoc-in [:room :entities :shovel :opacity] tool-opacity)
(assoc-in [:room :entities :fairy-godfather :opacity] opacity)
@@ -83,14 +84,15 @@
:ego "If I become a knight, maybe Georgia McGorgeous will love me!")
(actions/in-love entities)
(actions/stop-walking entities :ego :face :right)
(actions/do-dialogue entities
: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!")
(when-not (get-in @entities [:room :entities :fairy-godfather :distracted?])
(actions/do-dialogue entities
: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!"))
(actions/update-state entities #(update-in % [:plaques-read] conj :sword)))
(defn read-broom-plaque [entities]
@@ -206,7 +208,7 @@
(particle-effect! (get-in entities [:room :entities :explode]) :reset)
(particle-effect! (get-in entities [:room :entities :explode]) :start)
(update-in entities [:room :entities] dissoc :sword))
(update-in entities [:room :entities] dissoc :case))
entities))
(done? [this screen entities]
@@ -311,7 +313,7 @@
:entities {:magic (assoc (particle-effect "dream/magic") :x 160 :y 80 :baseline 240)
:clouds (assoc (particle-effect "dream/cloudy2") :x 160 :y 120 :baseline 241)
:sword (assoc (texture "dream/sword.png")
:case (assoc (texture "dream/case.png")
:x 144 :y 122 :baseline 139
:script (actions/get-script entities
(read-sword-plaque entities))
@@ -319,7 +321,9 @@
(if (get-in @entities [:room :entities :fairy-godfather :distracted?])
(do (actions/walk-to entities :ego [148 76] :face :right)
(swing entities)
(actions/play-animation entities :ego :reach)
(actions/play-animation entities :ego :reach-start :stop? false)
(actions/remove-entity entities :sword)
(actions/play-animation entities :ego :reach-stop)
(actions/give entities :dream-sword)
(actions/do-dialogue entities :ego "Yes! Now, before he gets back!")
(actions/pause-camera entities)
@@ -328,8 +332,8 @@
(actions/remove-item entities :dream-sword)
(actions/remove-item entities :broom)
(actions/remove-item entities :shovel)
(actions/resume-camera entities)
(actions/transition-background entities :inside-castle [79 145] :time 5.0)
(actions/resume-camera entities)
(actions/walk-to entities :ego [159 74])
(actions/do-dialogue entities
:ego "Man! What a dream!"
@@ -345,6 +349,9 @@
(do (actions/walk-to entities :ego [148 76] :face :right)
(actions/do-dialogue entities
:fairy-godfather "What are you doing?" :ego "Erm... Nothing."))))})
:sword (assoc (texture "dream/sword.png")
:x 144 :y 122 :baseline 139)
:explode (assoc (particle-effect "dream/explode") :x 150 :y 138 :baseline 240)
:broom (assoc (texture "dream/broom.png") :x 286 :y 122
:path (catmull-rom-spline (map #(apply vector-2* %) [[286 122] [286 128]]) true)

View File

@@ -1,6 +1,7 @@
(ns advent.screens.rooms.inside-castle
(:require [advent.screens.rooms :as rooms]
[advent.actions :as actions]
[advent.screens.rooms.common :as common]
[advent.screens.items :as items]
[advent.utils :as utils]
[advent.tween :as tween]
@@ -199,6 +200,7 @@
:ego "Worthy in wisdom, courage, and might,\nOnly then with sword he'll fight. ")
(if (= 3 (count missing-items))
(do
(actions/walk-to entities :ego [115 54])
(actions/do-dialogue entities
:ego "I have to prove myself worthy in wisdom, courage, and might!"
:ego "Then I can become a knight and impress Georgia McGorgeous!")
@@ -240,7 +242,9 @@
:cursor :right
:script (actions/get-script entities
(actions/walk-to entities :ego [284 145])
(actions/transition-background entities :outside-castle [82 180])
(actions/walk-straight-to entities :ego [295 145])
(actions/transition-background entities :outside-castle [61 182])
(actions/walk-straight-to entities :ego [82 180])
(actions/walk-to entities :ego [129 148]))}
:up-door {:box [50 150 70 170]
:script (actions/get-script entities
@@ -353,6 +357,16 @@
:x 22
:y 110
:baseline 95)
:walkie-talkie (assoc (texture "inside-castle/walkie-talkie.png")
:x 257
:y 135
:baseline 0
:script (actions/get-script entities
(actions/talk entities :ego "Let's give it a listen.")
(actions/walk-to entities :ego [272 136] :face :left)
(actions/play-animation entities :ego :start-squat-2 :stop? false)
(common/listen-to-frankie entities)
(actions/play-animation entities :ego :end-squat)))
:trophy (assoc (animation->texture screen trophy)
:x 253 :y 69 :baseline 191
@@ -454,6 +468,10 @@
(if (actions/has-item? entities :sword)
(update-in entities [:room :entities] #(dissoc % :sword))
entities)
(if (and (not (actions/has-item? entities :walkie-talkies))
(actions/has-obtained? entities :walkie-talkies))
entities
(update-in entities [:room :entities] dissoc :walkie-talkie))
(if (#{:night :sunrise} (get-in entities [:state :time]))
(make-night entities)
entities)))

View File

@@ -223,10 +223,13 @@
(actions/update-state entities #(assoc % :seen-frankie? true)))
(defn go-through-gate [entities]
(actions/walk-to entities :ego [82 180])
(if (should-block? entities)
(block-entrance entities)
(do
(actions/walk-to entities :ego [82 180] :face :left)
(block-entrance entities))
(do
(actions/walk-to entities :ego [82 180])
(actions/walk-straight-to entities :ego [61 182])
(actions/transition-background entities :inside-castle [295 145])
(actions/walk-to entities :ego [245 90]))))
@@ -291,9 +294,12 @@
(actions/play-animation entities :ego :squat)
(actions/talk entities :ego "No one will notice one missing.")
(actions/give entities :carrot))))}}
:layers {:day [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]
:night [(assoc (texture "outside-castle/background-dark.png") :x 0 :y 0 :baseline 0)]
:sunrise [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]}
:layers {:day [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "outside-castle/walk-behind.png") :x 0 :y 0 :baseline 240)]
:night [(assoc (texture "outside-castle/background-dark.png") :x 0 :y 0 :baseline 0)
(assoc (texture "outside-castle/walk-behind-dark.png") :x 0 :y 0 :baseline 240)]
:sunrise [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "outside-castle/walk-behind.png") :x 0 :y 0 :baseline 240)]}
:entities {:peddler (actions/start-animation screen
(assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil
:anim-sound-frames {peddler-stand {23 [:scratch 1.0]}

View File

@@ -82,8 +82,7 @@
(actions/talk entities :ego "This must be Frankie Rockfist's secret stash!")))
(defn make [screen]
(let [fountain (utils/make-anim "outside-jail/fountain.png" [42 50] 0.2 (range 3))
guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87)
(let [guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87)
guard-stand (animation 0.1 [(aget guard-sheet 0 0)])
guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]] (aget guard-sheet 0 i)))
guard-sleep (utils/make-anim "outside-jail/guard-sleep.png" [43 67] 0.1 (range 4))
@@ -159,24 +158,25 @@
(actions/remove-item entities :rope)
(actions/add-entity entities :rope (get-in @entities [:room :rope]))))}}
:end-of-rope {:box [177 101 185 108]
:script (actions/get-script entities (try-to-go-in-stash entities))}}
:layers {:day [(assoc (texture "outside-jail/background.png") :x 0 :y 0 :baseline 0)]
:night [(assoc (texture "outside-jail/background-dark.png") :x 0 :y 0 :baseline 0)]}
:entities {:fountain (assoc (animation->texture screen fountain)
:x 150 :y 126 :baseline 114
:script (actions/get-script entities
(actions/walk-to entities :ego [151 119] :face :right)
(actions/play-animation entities :ego :reach)
(actions/do-dialogue entities :ego "Ahh, life-giving water."
:ego "I feel strength."
:ego "And renewal!"))
:scripts {:flask-2 (actions/get-script entities
(actions/walk-to entities :ego [151 119] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :flask-2)
(actions/give entities :flask-water)
(actions/talk entities :ego "Filled up with water, just as Gandarf wanted."))})
:warden {:object nil
:script (actions/get-script entities (try-to-go-in-stash entities))}
:fountain {:box [150 126 193 147]
:script (actions/get-script entities
(actions/walk-to entities :ego [151 119] :face :right)
(actions/play-animation entities :ego :reach)
(actions/do-dialogue entities :ego "Ahh, life-giving water."
:ego "I feel strength."
:ego "And renewal!"))
:scripts {:flask-2 (actions/get-script entities
(actions/walk-to entities :ego [151 119] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :flask-2)
(actions/give entities :flask-water)
(actions/talk entities :ego "Filled up with water, just as Gandarf wanted."))}}}
:layers {:day [(assoc (texture "outside-jail/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "outside-jail/fountain.png") :x 0 :y 0 :baseline 114)]
:night [(assoc (texture "outside-jail/background-dark.png") :x 0 :y 0 :baseline 0)
(assoc (texture "outside-jail/fountain-dark.png") :x 0 :y 0 :baseline 114)]}
:entities {:warden {:object nil
:x 36
:y 86
:width 10

View File

@@ -15,10 +15,10 @@
[advent.utils :as utils]
[advent.tween :as tween]
[advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common]
[advent.screens.items :as items]
[advent.screens.rooms.dream :as rooms.dream]
[advent.screens.rooms.castle-gate :as rooms.castle-gate]
[advent.screens.rooms.common :as common]
[advent.screens.rooms.outside-house :as rooms.outside-house]
[advent.screens.rooms.inside-house :as rooms.inside-house]
[advent.screens.rooms.inside-stash :as rooms.inside-stash]
@@ -161,7 +161,9 @@
(texture (aget talk-sheet 0 i))))
start-squat (animation 0.05 (for [i [0 1 2 3 4]]
(texture (aget squat-sheet 0 i))))
end-squat (animation 0.05 (for [i [4 3 2 1 0]]
start-squat-2 (animation 0.05 (for [i [0 1 2 3]]
(texture (aget squat-sheet 0 i))))
end-squat (animation 0.05 (for [i [3 2 1 0]]
(texture (aget squat-sheet 0 i))))
squat-anim (animation 0.05 (for [i [0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 2 1] ]
(texture (aget squat-sheet 0 i))))
@@ -215,6 +217,7 @@
:talk talk-anim
:squat squat-anim
:start-squat start-squat
:start-squat-2 start-squat-2
:end-squat end-squat
:reach reach-anim
:cat-toy cat-toy-anim
@@ -257,6 +260,7 @@
:stand (utils/flip stand-anim)
:talk (utils/flip talk-anim)
:start-squat (utils/flip start-squat)
:start-squat-2 (utils/flip start-squat-2)
:end-squat (utils/flip end-squat)
:squat (utils/flip squat-anim)
:reach (utils/flip reach-anim)
@@ -340,7 +344,6 @@
:camera (actions/get-script entities (actions/talk entities :ego "It's some sort of magical device that captures images."))
:alarm-clock (actions/get-script entities (actions/talk entities :ego "It's a magic device that tells the time."))
:walkie-talkies (actions/get-script entities (actions/do-dialogue entities :ego "If I talk in one of these devices, I can hear it in the other one!"))
:walkie-talkie (actions/get-script entities (common/listen-to-frankie entities))
nil))
:x (first start-pos) :y (last start-pos)
:id "ego"}
@@ -694,7 +697,7 @@
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
(screen! talking-screen :on-update-camera :scene-viewport (:viewport screen) :scene-camera (:camera screen))
(when (not (get-in entities [:cam :paused?]))
(when true #_(not (get-in entities [:cam :paused?]))
(set! (. camera zoom) (:zoom (:cam entities)))
(set! (.. camera position x) (:x (:cam entities) 160.0))
(set! (.. camera position y) (:y (:cam entities) 120.0)))