This commit is contained in:
Bryce Covert
2017-08-10 19:55:06 -07:00
1305 changed files with 14202 additions and 4888 deletions

View File

@@ -11,13 +11,14 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all])
)
(println "loading behindhouse")
(defn make-night [entities]
(assoc-in entities [:room :entities :peeling :opacity] 0))
(defn make-left-dir [box]
{:box box
:script (actions/get-script
:only-script (actions/get-script
entities
(actions/walk-to entities :ego [122 140] :skip-type :end)
(actions/transition-background entities :outside-house [244 150])
@@ -28,9 +29,8 @@
(actions/update-state entities
(fn [state] (assoc state :safe-listen-count (inc (:safe-listen-count state 0))))))
(defn make [screen]
(rooms/make :music {:day :town-2 :night :night}
:name "Behind house"
(defn make [screen atlas global-atlas]
(rooms/make :name "Behind house"
:interactions
{:left-dir-1 (make-left-dir [0 48 20 240])
:left-dir-2 (make-left-dir [0 160 148 217])
@@ -42,6 +42,8 @@
entities
)}
:mushrooms {:box [247 59 269 76]
:label "Mushrooms"
:cursor :hand
:script (actions/get-script
entities
(if (actions/has-obtained? entities :mushrooms)
@@ -52,116 +54,122 @@
(actions/give entities :mushrooms)
(actions/talk entities :ego "Perfectly ripe mushrooms!"))))}
:window {:box [109 100 130 153]
:label "Window"
:cursor :look
:script (actions/get-script
entities
(actions/walk-to entities :ego [128 100] :face :left)
(cond
(= :night (get-in @entities [:state :time]))
(actions/do-dialogue entities :ego "The house is dark and empty.")
(= :night (get-in @entities [:state :time]))
(actions/do-dialogue entities :ego "The house is dark and empty.")
(actions/has-obtained? entities :tune)
(actions/do-dialogue entities
:ego "Gandarf's just working on one of his spells.")
(actions/has-obtained? entities :tune)
(actions/do-dialogue entities
:ego "Gandarf's just working on one of his spells.")
(get-in @entities [:state :peeked-in-window?])
(actions/do-dialogue entities
:ego "Gandarf is moving around in the corner of the room."
:ego "I think he's opening his MagiSafe!"
:ego "I'll need a better spying angle if I hope to crack the safe.")
(get-in @entities [:state :peeked-in-window?])
(actions/do-dialogue entities
:ego "Gandarf is moving around in the corner of the room."
:ego "I think he's opening his MagiSafe!"
:ego "I'll need a better spying angle if I hope to crack the safe.")
:else
(do
(actions/do-dialogue entities
:ego "I can see Gandarf moving around in the corner of the room."
:ego "It's hard to make out from this angle.")
(actions/update-state entities #(assoc % :peeked-in-window? true)))))}}
:layers {:day [(assoc (utils/get-texture "behindhouse/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "behindhouse/house.png") :x 0 :y 0 :baseline 122)
(assoc (utils/get-texture "behindhouse/brush.png") :x 0 :y 0 :baseline 240)
(assoc (utils/get-texture "behindhouse/fgleft.png") :x -10 :y 0 :baseline 240 :parallax 1.5)
(assoc (utils/get-texture "behindhouse/fg2.png") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]
:night [(assoc (utils/get-texture "behindhouse/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "behindhouse/house.png") :x 0 :y 0 :baseline 122)
(assoc (utils/get-texture "behindhouse/brush.png") :x 0 :y 0 :baseline 240)
(assoc (utils/get-texture "behindhouse/fgleft.png") :x -10 :y 0 :baseline 240 :parallax 1.5)
(assoc (utils/get-texture "behindhouse/fg2.png") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]}
:entities {:stick (assoc (utils/get-texture "behindhouse/stick.png")
:x 26 :y 80 :baseline 160
:script (actions/get-script entities
(actions/walk-to entities :ego [50 80])
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :stick)
(actions/give entities :stick)
(actions/talk entities :ego "This stick might be useful.")))
:else
(do
(actions/do-dialogue entities
:ego "I can see Gandarf moving around in the corner of the room."
:ego "It's hard to make out from this angle.")
(actions/update-state entities #(assoc % :peeked-in-window? true)))))}}
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
(assoc (utils/atlas->texture atlas "brush") :x 0 :y 0 :baseline 240)
(assoc (utils/atlas->texture atlas "fgleft") :x -10 :y 0 :baseline 240 :parallax 1.5)
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
(assoc (utils/atlas->texture atlas "brush") :x 0 :y 0 :baseline 240)
(assoc (utils/atlas->texture atlas "fgleft") :x -10 :y 0 :baseline 240 :parallax 1.5)
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]}
:entities {:stick (assoc (utils/atlas->texture atlas "stick")
:x 26 :y 80 :baseline 160
:label "Stick"
:cursor :hand
:script (actions/get-script entities
(actions/walk-to entities :ego [50 80])
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :stick)
(actions/give entities :stick)
(actions/talk entities :ego "This stick might be useful.")))
:peeling (assoc (utils/get-texture "behindhouse/house-cover.png")
:x 60 :y 92 :baseline 148
:script (actions/get-script entities
(cond (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "The house is empty right now.")
:peeling (assoc (utils/atlas->texture atlas "house-cover")
:x 60 :y 92 :baseline 148
:label "Crumbly wall"
:cursor :hand
:script (actions/get-script entities
(cond (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "The house is empty right now.")
(and (get-in @entities [:state :opened-crack?])
(= 0 (get-in @entities [:state :safe-listen-count] 0)))
(and (get-in @entities [:state :opened-crack?])
(= 0 (get-in @entities [:state :safe-listen-count] 0)))
(do (actions/walk-to entities :ego [70 80])
(actions/play-animation entities :ego :start-squat :stop? false)
(actions/talk entities :ego "I can see Gandarf the wizard inside." :animate? false :stop? false)
(actions/talk entities :ego "It looks like he's opening his MagiSafe." :animate? false :stop? false)
(actions/play-safe entities false)
(actions/talk entities :ego "So that's the code to his safe..." :animate? false :stop? false)
(actions/play-animation entities :ego :end-squat)
(actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there.")
(steam/set-achievement "SAFE_AND_SOUND")
(increment-safe-listens entities))
(do (actions/walk-to entities :ego [70 80])
(actions/play-animation entities :ego :start-squat :stop? false)
(actions/talk entities :ego "I can see Gandarf the wizard inside." :animate? false :stop? false)
(actions/talk entities :ego "It looks like he's opening his MagiSafe." :animate? false :stop? false)
(actions/play-safe entities false)
(actions/talk entities :ego "So that's the code to his safe..." :animate? false :stop? false)
(actions/play-animation entities :ego :end-squat)
(actions/talk entities :ego "A lot of good it'll do me to know his password while he's still there.")
(steam/set-achievement "SAFE_AND_SOUND")
(increment-safe-listens entities))
(and (get-in @entities [:state :opened-crack?])
(= 1 (get-in @entities [:state :safe-listen-count] 0)))
(and (get-in @entities [:state :opened-crack?])
(= 1 (get-in @entities [:state :safe-listen-count] 0)))
(do (actions/walk-to entities :ego [70 80])
(actions/talk entities :ego "I'll give it another listen.")
(actions/play-animation entities :ego :start-squat :stop? false)
(actions/talk entities :ego "It looks like Gandarf's opening his MagiSafe." :animate? false :stop? false)
(actions/play-safe entities false)
(actions/play-animation entities :ego :end-squat)
(actions/talk entities :ego "Ugh! Now I've got it stuck in my head!")
(increment-safe-listens entities)
(actions/give entities :tune))
(do (actions/walk-to entities :ego [70 80])
(actions/talk entities :ego "I'll give it another listen.")
(actions/play-animation entities :ego :start-squat :stop? false)
(actions/talk entities :ego "It looks like Gandarf's opening his MagiSafe." :animate? false :stop? false)
(actions/play-safe entities false)
(actions/play-animation entities :ego :end-squat)
(actions/talk entities :ego "Ugh! Now I've got it stuck in my head!")
(increment-safe-listens entities)
(actions/give entities :tune))
(get-in @entities [:state :opened-crack?])
(actions/talk entities :ego "I've got the tune stuck in my head already.")
(get-in @entities [:state :opened-crack?])
(actions/talk entities :ego "I've got the tune stuck in my head already.")
:else
(do (actions/walk-to entities :ego [80 80] :face :left)
(actions/talk entities :ego "It looks like the wall is crumbling here.")
(actions/play-animation entities :ego :reach)
(actions/update-entity entities :peeling #(assoc % :opacity 0))
(actions/update-state entities (fn [state] (assoc state :opened-crack? true))))))
:scripts {:stick (actions/get-script entities
(if (get-in @entities [:state :opened-crack?])
(actions/talk entities :ego "I could shove the stick in that hole, but why?")
(actions/do-dialogue entities
:ego "It looks like that wall is crumbling."
:ego "I can probably scratch it off with my hand.")))
:sword (actions/get-script entities
(actions/do-dialogue entities
:ego "I should be careful with this sword."
:ego "It's sharp!"))})
:bird (utils/make-bird screen [[50 235] [80 220] [100 239] [180 235] [85 225]])
:else
(do (actions/walk-to entities :ego [80 80] :face :left)
(actions/talk entities :ego "It looks like the wall is crumbling here.")
(actions/play-animation entities :ego :reach)
(actions/update-entity entities :peeling #(assoc % :opacity 0))
(actions/update-state entities (fn [state] (assoc state :opened-crack? true))))))
:scripts {:stick (actions/get-script entities
(if (get-in @entities [:state :opened-crack?])
(actions/talk entities :ego "I could shove the stick in that hole, but why?")
(actions/do-dialogue entities
:ego "It looks like that wall is crumbling."
:ego "I can probably scratch it off with my hand.")))
:sword (actions/get-script entities
(actions/do-dialogue entities
:ego "I should be careful with this sword."
:ego "It's sharp!"))})
:bird (utils/make-bird screen global-atlas [[50 235] [80 220] [100 239] [180 235] [85 225]])
:outside-particles (common/make-outside-particles)}
:collision "behindhouse/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:apply-state (fn [_ entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(if (get-in entities [:state :opened-crack?])
(assoc-in entities [:room :entities :peeling :opacity] 0)
entities)
(if (actions/has-obtained? entities :stick)
(update-in entities [:room :entities] #(dissoc % :stick))
entities)
(if (= :night (get-in entities [:state :time]))
(make-night entities)
entities)))
(if (get-in entities [:state :opened-crack?])
(assoc-in entities [:room :entities :peeling :opacity] 0)
entities)
(if (actions/has-obtained? entities :stick)
(update-in entities [:room :entities] #(dissoc % :stick))
entities)
(if (= :night (get-in entities [:state :time]))
(make-night entities)
entities)))
:start-pos [172 122]))

View File

@@ -16,15 +16,18 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn make-night [entities]
entities)
(defn make-coin-flip [screen]
(let [coin-flip (utils/make-anim "castle-gate/coinflip.png" [10 10] 0.05 (range 5))]
(defn make-coin-flip [screen atlas]
(let [coin-flip (utils/make-anim atlas "coinflip" [10 10] 0.05 (range 5))]
(assoc (animation->texture screen coin-flip)
:x 212 :y 114 :baseline 151
:opacity 0.0
:label "Coin"
:cursor :hand
:origin-x 5
:origin-y 5
:night-profile :none
@@ -38,10 +41,12 @@
:walk coin-flip
:coinflip coin-flip)))
(defn make-goon-1 [screen]
(let [stand (utils/make-anim "castle-gate/goon-1.png" [13 33] 0.21 [0 0 0 0 0 0 0 0 0 1])]
(defn make-goon-1 [screen atlas]
(let [stand (utils/make-anim atlas "goon-1" [13 33] 0.21 [0 0 0 0 0 0 0 0 0 1])]
(assoc (animation->texture screen stand)
:x 244 :y 102 :baseline 138
:label "Goon"
:cursor :talk
:scale-x 1.4
:scale-y 1.4
:night-profile :sprite
@@ -49,18 +54,21 @@
:anim-start 0
:stand stand)))
(defn make-goon-2 [screen]
(let [stand (utils/make-anim "castle-gate/goon-2.png" [12 32] 0.175 [0 0 0 0 0 0 0 0 0 0 0 0 0 1])
talk (utils/make-anim "castle-gate/goon-2-talk.png" [12 32] 0.175 (range 2))
flip (utils/make-anim "castle-gate/goon-2-flip.png" [12 32] 0.05 [1 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ])
search (utils/make-anim "castle-gate/goon-2-search.png" [24 32] 0.3 [0 1 2 3 2 3 2 1 4 5 6 5 6 7 6 7 6 7 6 1 0])
walk (utils/flip (utils/make-anim "castle-gate/goon-2-walk.png" [24 34] 0.075 (range 7)))]
(defn make-goon-2 [screen atlas]
(let [
stand (utils/make-anim atlas "goon-2" [12 32] 0.175 [0 0 0 0 0 0 0 0 0 0 0 0 0 1])
talk (utils/make-anim atlas "goon-2-talk" [12 32] 0.175 (range 2))
flip (utils/make-anim atlas "goon-2-flip" [12 32] 0.05 [1 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ])
search (utils/make-anim atlas "goon-2-search" [24 32] 0.3 [0 1 2 3 2 3 2 1 4 5 6 5 6 7 6 7 6 7 6 1 0])
walk (utils/flip (utils/make-anim atlas "goon-2-walk" [24 34] 0.075 (range 7)))]
(assoc (animation->texture screen stand)
:x 214 :y 102 :baseline 151
:scale-x 1.4
:scale-y 1.4
:origin-x 6
:origin-y 0
:label "Bubba"
:cursor :talk
:anim stand
:talk talk
:flip flip
@@ -91,7 +99,7 @@
(assoc-in [:room :entities :coin-flip :opacity] 1.0))))
(actions/walk-straight-to entities :coin-flip [212 90] :update-baseline? false :speed 3.0)
(screen! dialogue/talking-screen :stop-talk)
(screen! dialogue/talking-screen :stop-talk {})
(actions/do-stop entities :ego)
(actions/walk-straight-to entities :coin-flip [210 105] :update-baseline? false :speed 1.0)
@@ -127,6 +135,7 @@
(actions/walk-to entities :ego [245 90] :skip-type :end))
(defn flip-coin [screen entities]
(println "here")
(if (and (= 0 (rand-int 2))
(not (get-in entities [:state :has-dropped-coin?]))
(not (get-in entities [:state :bubba-gone?]))
@@ -182,16 +191,18 @@
(defn make-note []
{:box [97 102 111 132]
:label "Note"
:cursor :look
:script (actions/get-script entities
(look-at-note entities))
:scripts {:charcoal (actions/get-script entities
(sign-note entities))}})
(defn make [screen]
(let [throw-walkie (utils/make-anim-seq "castle-gate/throw-walkie" [205 136] 0.1 (flatten [(repeat 55 0) (range 9) (repeat 55 8)]))
walkie-visible (animation 1.0 [(utils/get-texture "castle-gate/throw-walkie-9.png")])
walkie-invisible (animation 1.0 [(utils/get-texture "castle-gate/throw-walkie-1.png")])]
(rooms/make :music {:day :town-2 :night :night}
(defn make [screen atlas global-atlas]
(let [throw-walkie (utils/make-anim-seq atlas "throw-walkie" [205 136] 0.1 (flatten [(repeat 55 0) (range 9) (repeat 55 8)]))
walkie-visible (animation 1.0 [(utils/atlas->texture atlas "throw-walkie" 8)])
walkie-invisible (animation 1.0 [(utils/atlas->texture atlas "throw-walkie" 0)])]
(rooms/make
:name "Castle gate"
:timers {:taunt [1.0 6.0 flip-coin]}
:interactions {:right-dir {:box [280 40 320 83]
@@ -207,6 +218,8 @@
:cursor :left}
:window {:box [192 157 215 215]
:label "Window"
:cursor :look
:script (actions/get-script entities
(actions/talk entities :ego "That's a big window!"))
:scripts {:walkie-talkies (actions/get-script entities
@@ -223,15 +236,15 @@
(actions/walk-straight-to entities :ego [285 71]))}}
:note (make-note)}
:layers {:day [(assoc (utils/get-texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "castle-gate/overlay.png") :x 0 :y 0 :baseline 240)]
:night [(assoc (utils/get-texture "castle-gate/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "castle-gate/overlay.png") :x 0 :y 0 :baseline 240)]}
:entities {:frankie (common/make-frankie screen)
:goon-1 (make-goon-1 screen)
:goon-2 (make-goon-2 screen)
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "overlay") :x 0 :y 0 :baseline 240)]
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "overlay") :x 0 :y 0 :baseline 240)]}
:entities {:frankie (common/make-frankie screen global-atlas)
:goon-1 (make-goon-1 screen atlas)
:goon-2 (make-goon-2 screen atlas)
:outside-particles (common/make-outside-particles)
:coin-flip (make-coin-flip screen)
:coin-flip (make-coin-flip screen atlas)
}
:walkie-talkies (rooms/make-entity :walkie-talkies
(assoc (animation->texture screen walkie-visible)
@@ -260,8 +273,7 @@
(if (and (not (actions/has-obtained? entities :money))
(get-in entities [:state :has-dropped-coin?]))
(do
(update-in entities [:room :entities :coin-flip] assoc :x 185 :y 44 :opacity 1.0))
(do (update-in entities [:room :entities :coin-flip] assoc :x 185 :y 44 :opacity 1.0))
entities)
(if (actions/has-obtained? entities :money)
(update-in entities [:room :entities] dissoc :coin-flip)

View File

@@ -11,6 +11,9 @@
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn get-down [entities & break]
(actions/walk-straight-to entities :ego [151 50] :update-baseline? false :face :left)
@@ -244,6 +247,8 @@
:ego "Thanks, I guess."))
(defn make-ladder-area [box]
{:box box
:cursor :hand
:label "Tree"
:script (actions/get-script entities
(actions/walk-to entities :ego [144 58] )
(actions/talk entities :ego "Maybe I can climb it!")
@@ -260,57 +265,58 @@
(actions/walk-straight-to entities :ego [140 85] :face :right :update-baseline? false)
(actions/add-entity entities :blank (get-in @entities [:room :blank])))}})
(defn make [screen]
(let [cat-stand-sheet (texture! (utils/get-texture "cat-tree/cat-stand.png") :split 22 10)
(defn make [screen atlas global-atlas]
(let [cat-stand-sheet (texture! (utils/atlas->texture atlas "cat-stand") :split 22 10)
cat-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0])]
(aget cat-stand-sheet 0 i)))
cat-walk (animation 0.2 [(utils/get-texture "cat-tree/pounce.png")])
destroy-ladder (utils/make-anim "cat-tree/destroy-ladder.png" [29 38] 0.1 (range 18))
ladder-entity (assoc (utils/get-texture "inside-cafeteria/ladder.png") :x 130 :y 60 :baseline 162
cat-walk (animation 0.2 [(utils/atlas->texture atlas "pounce")])
destroy-ladder (utils/make-anim atlas "destroy-ladder" [29 38] 0.1 (range 18))
ladder-entity (assoc (utils/atlas->texture atlas "ladder") :x 130 :y 60 :baseline 162
:origin-x 0
:destroy-ladder destroy-ladder
:ladder-break-sound (utils/load-sound "cat-tree/ladder-break.ogg")
:anim-sound-frames {destroy-ladder {4 [:ladder-break-sound 0.6]}})
grandma-stand (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
grandma-squat-1 (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [3 4 5 5 5 5 5])
grandma-squat-2 (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [5 5 4 3])
grandma-talk (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 2 0 2 0 2 0 2 0 2 0 1 0 2 0 0])
grandma-kiss (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 8 9 10 9 10 9 10 9 8 0])
grandma-cry (utils/make-anim-seq "cat-tree/grandma-cry" [58 40] 0.15 (flatten [(range 20) 0 0 0 0 0 0 0 0 0]))
owl-stand (utils/make-anim "cat-tree/owl.png" [21 30] 0.2 [0 0 0 0 0 0 0 2])
owl-talk (utils/make-anim "cat-tree/owl.png" [21 30] 0.2 [1 0 1 0 1 0 0 0 2 0])
owl-puke (utils/make-anim "cat-tree/owl.png" [21 30] 0.10 [0 0 2 2 3 2 2 3 3 2 3 3 3 4 5 6 7 4 4 3 3 2 2 2 2 2])
owl-eye (utils/make-anim-seq "cat-tree/eye" [44 48] 0.10 [0 0 1 1 2 2 2 2 2 2 2 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 3 4 4 4 3 4 4 4 5 6 7 8 9 9 9 9 9 9 9 9 9 10 11 12 12 11 10 9 9 9 9 9 9 9 9 10 11 12 12 12 11 10 9 9 9 9 9 8 7 6 5])
grandma-stand (utils/make-anim atlas "grandma" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
grandma-squat-1 (utils/make-anim atlas "grandma" [25 36] 0.2 [3 4 5 5 5 5 5])
grandma-squat-2 (utils/make-anim atlas "grandma" [25 36] 0.2 [5 5 4 3])
grandma-talk (utils/make-anim atlas "grandma" [25 36] 0.2 [0 2 0 2 0 2 0 2 0 2 0 1 0 2 0 0])
grandma-kiss (utils/make-anim atlas "grandma" [25 36] 0.2 [0 8 9 10 9 10 9 10 9 8 0])
grandma-cry (utils/make-anim-seq atlas "grandma-cry" [58 40] 0.15 (flatten [(range 20) 0 0 0 0 0 0 0 0 0]))
owl-stand (utils/make-anim atlas "owl" [21 30] 0.2 [0 0 0 0 0 0 0 2])
owl-talk (utils/make-anim atlas "owl" [21 30] 0.2 [1 0 1 0 1 0 0 0 2 0])
owl-puke (utils/make-anim atlas "owl" [21 30] 0.10 [0 0 2 2 3 2 2 3 3 2 3 3 3 4 5 6 7 4 4 3 3 2 2 2 2 2])
owl-eye (utils/make-anim-seq atlas "eye" [44 48] 0.10 [0 0 1 1 2 2 2 2 2 2 2 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 3 4 4 4 3 4 4 4 5 6 7 8 9 9 9 9 9 9 9 9 9 10 11 12 12 11 10 9 9 9 9 9 9 9 9 10 11 12 12 12 11 10 9 9 9 9 9 8 7 6 5])
puke (particle-effect "particles/puke")]
(rooms/make :music {:day :town-2 :night :night}
:name "Tree"
(rooms/make :name "Tree"
:sounds {:cat (utils/load-sound "cat-tree/cat.ogg")
:kiss (utils/load-sound "cat-tree/kiss.ogg")}
:ladder ladder-entity
:blank (rooms/make-entity :blank
{:object nil :x 0 :y 0 :width 320 :height 240 :baseline 240
:script (actions/get-script entities
:only-script (actions/get-script entities
(when (get-in @entities [:room :entities :ladder])
(actions/talk entities :ego "I'll get down.")
(get-down entities)))})
:interactions
{:down-dir {:box [150 0 270 20]
:script (actions/get-script entities
(if (get-in @entities [:room :entities :ladder])
(do
(actions/talk entities :ego "I'll get down.")
(get-down entities)))
(actions/walk-to entities :ego [200 10] :skip-type :end :stop? false)
(actions/walk-straight-to entities :ego [223 -51])
(actions/transition-background entities :outside-house [137 204])
(actions/walk-to entities :ego [158 110] :skip-type :end))
:only-script (actions/get-script entities
(if (get-in @entities [:room :entities :ladder])
(do
(actions/talk entities :ego "I'll get down.")
(get-down entities)))
(actions/walk-to entities :ego [200 10] :skip-type :end :stop? false)
(actions/walk-straight-to entities :ego [223 -51])
(actions/transition-background entities :outside-house [137 204])
(actions/walk-to entities :ego [158 110] :skip-type :end))
:cursor :down}
:ladder-area-1 (make-ladder-area [123 100 167 199])
:ladder-area-2 (make-ladder-area [87 151 227 212])
:ladder-area-3 (make-ladder-area [133 69 205 92])
:rock {:box [62 83 101 103]
:cursor :hand
:label "Suspicous looking rock"
:script (actions/get-script entities
(when (and (actions/has-obtained? entities :note-1)
(not (actions/has-obtained? entities :walkie-talkies)))
@@ -330,6 +336,8 @@
(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]
:cursor :hand
:label "Grass"
:script (actions/get-script entities
(if (not (actions/has-obtained? entities :grass))
(do
@@ -340,6 +348,8 @@
:ego "It's a high protein variety."))
(actions/talk entities :ego "I don't really need any more grass.")))}
:grandma {:box [109 33 132 98]
:cursor :talk
:label "Damsel"
:script (actions/get-script entities (do-grandma-dialogue entities))
:scripts #(condp = %
:kiss
@@ -350,71 +360,73 @@
(actions/do-dialogue entities :grandma "No thank you, handsome.")
(if (get-in @entities [:room :entities :ladder])
(actions/do-stop entities :ego :face :right))))
}}
:layers {:day [(assoc (utils/get-texture "cat-tree/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "cat-tree/tree-and-rock.png") :x 0 :y 0 :baseline 161)
(assoc (utils/get-texture "cat-tree/brush-l.png") :x -5 :y -5 :parallax 1.3 :baseline 240)
(assoc (utils/get-texture "cat-tree/tree-r.png") :x 270 :y 0 :scale-x 1.1 :scale-y 1.1 :parallax 1.5 :baseline 240)]
:night [(assoc (utils/get-texture "cat-tree/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "cat-tree/tree-and-rock.png") :x 0 :y 0 :baseline 161)
(assoc (utils/get-texture "cat-tree/brush-l.png") :x -5 :y -5 :parallax 1.3 :baseline 240)
(assoc (utils/get-texture "cat-tree/tree-r.png") :x 270 :y 0 :scale-x 1.1 :scale-y 1.1 :parallax 1.5 :baseline 240)]}
}}
:layers {:day [(assoc (utils/atlas->texture atlas "background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "tree-and-rock.png") :x 0 :y 0 :baseline 161)
(assoc (utils/atlas->texture atlas "brush-l.png") :x -5 :y -5 :parallax 1.3 :baseline 240)
(assoc (utils/atlas->texture atlas "tree-r.png") :x 270 :y 0 :scale-x 1.1 :scale-y 1.1 :parallax 1.5 :baseline 240)]
:night [(assoc (utils/atlas->texture atlas "background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "tree-and-rock.png") :x 0 :y 0 :baseline 161)
(assoc (utils/atlas->texture atlas "brush-l.png") :x -5 :y -5 :parallax 1.3 :baseline 240)
(assoc (utils/atlas->texture atlas "tree-r.png") :x 270 :y 0 :scale-x 1.1 :scale-y 1.1 :parallax 1.5 :baseline 240)]}
:entities {
:outside-particles (common/make-outside-particles)
:cat (actions/start-animation screen
(assoc (animation->texture screen cat-stand)
:x 184 :y 173 :baseline 1000
:walk cat-walk
:stand cat-stand
:script (actions/get-script entities
(actions/talk entities :ego "Here kitty, kitty, kitty.")
(actions/talk entities :ego "Kitty's so bored, he doesn't even notice me."))
:scripts {:cat-toy (actions/get-script entities
(actions/play-animation entities :ego :cat-toy)
(if (get-in @entities [:room :entities :ladder])
(do (actions/talk entities :ego "I think he's going for it!")
(actions/play-animation entities :ego :cat-toy-first-half :stop? false)
(actions/play-sound entities :cat 0.5)
(actions/walk-straight-to entities :cat [138 40] :update-baseline? false :speed 3)
(actions/play-animation entities :ego :cat-toy-last-half)
(actions/play-animation entities :grandma :squat-1 :stop? false)
(actions/remove-entity entities :cat)
(actions/play-animation entities :grandma :squat-2)
(actions/do-dialogue entities :grandma "Thank you for rescuing my furry friend, young man!")
(get-down entities true)
(actions/walk-straight-to entities :ego [165 45] :face :left)
(actions/do-dialogue entities
:ego "It's no big deal."
:grandma "You won't go unrewarded!"
:grandma "Come here, young man.")
(actions/walk-straight-to entities :ego [133 35])
(actions/talk entities :grandma "For your impressive display of courage and bravery, I give you this. ")
(assoc (animation->texture screen cat-stand)
:x 184 :y 173 :baseline 1000
:label "Smuffle Wuffles"
:cursor :talk
:walk cat-walk
:stand cat-stand
:script (actions/get-script entities
(actions/talk entities :ego "Here kitty, kitty, kitty.")
(actions/talk entities :ego "Kitty's so bored, he doesn't even notice me."))
:scripts {:cat-toy (actions/get-script entities
(actions/play-animation entities :ego :cat-toy)
(if (get-in @entities [:room :entities :ladder])
(do (actions/talk entities :ego "I think he's going for it!")
(actions/play-animation entities :ego :cat-toy-first-half :stop? false)
(actions/play-sound entities :cat 0.5)
(actions/walk-straight-to entities :cat [138 40] :update-baseline? false :speed 3)
(actions/play-animation entities :ego :cat-toy-last-half)
(actions/play-animation entities :grandma :squat-1 :stop? false)
(actions/remove-entity entities :cat)
(actions/play-animation entities :grandma :squat-2)
(actions/do-dialogue entities :grandma "Thank you for rescuing my furry friend, young man!")
(get-down entities true)
(actions/walk-straight-to entities :ego [165 45] :face :left)
(actions/do-dialogue entities
:ego "It's no big deal."
:grandma "You won't go unrewarded!"
:grandma "Come here, young man.")
(actions/walk-straight-to entities :ego [133 35])
(actions/talk entities :grandma "For your impressive display of courage and bravery, I give you this. ")
(actions/play-sound entities :kiss 0.7)
(actions/play-animation entities :grandma :kiss)
(actions/play-animation entities :ego :get-sick :stop? false)
(actions/walk-straight-to entities :ego [165 45])
(actions/do-dialogue entities :ego
"Ugh! Gross!"
:ego "What's this?")
(actions/give entities :kiss)
(actions/do-dialogue entities :ego "A kiss for an inventory item?"
:ego "Sounds like the game designer was running out of good ideas.")
(steam/set-achievement "KITTY_KISS"))
(actions/talk entities :ego "I can't get his attention from way down here.")))
:stick (actions/get-script entities
(if (get-in @entities [:room :entities :ladder])
(do
(actions/play-animation entities :ego :poke)
(actions/do-dialogue entities
:ego "He's still too far for me to poke him."
:ego "Maybe I can encourage him to come down on his own."))
(do
(actions/walk-to entities :ego [210 58] :face :right)
(actions/play-animation entities :ego :poke)
(actions/talk entities :ego "I can't poke him from way down here."))))
:wool (actions/get-script entities (actions/talk entities :ego "I don't think the cat would notice the wool from all the way up there."))
:default (actions/get-script entities (actions/talk entities :ego "Kitty seems disinterested in it."))})
cat-stand)
(actions/play-animation entities :grandma :kiss)
(actions/play-animation entities :ego :get-sick :stop? false)
(actions/walk-straight-to entities :ego [165 45])
(actions/do-dialogue entities :ego
"Ugh! Gross!"
:ego "What's this?")
(actions/give entities :kiss)
(actions/do-dialogue entities :ego "A kiss for an inventory item?"
:ego "Sounds like the game designer was running out of good ideas.")
(steam/set-achievement "KITTY_KISS"))
(actions/talk entities :ego "I can't get his attention from way down here.")))
:stick (actions/get-script entities
(if (get-in @entities [:room :entities :ladder])
(do
(actions/play-animation entities :ego :poke)
(actions/do-dialogue entities
:ego "He's still too far for me to poke him."
:ego "Maybe I can encourage him to come down on his own."))
(do
(actions/walk-to entities :ego [210 58] :face :right)
(actions/play-animation entities :ego :poke)
(actions/talk entities :ego "I can't poke him from way down here."))))
:wool (actions/get-script entities (actions/talk entities :ego "I don't think the cat would notice the wool from all the way up there."))
:default (actions/get-script entities (actions/talk entities :ego "Kitty seems disinterested in it."))})
cat-stand)
:grandma (let [gma (assoc (animation->texture screen grandma-stand)
:x 130 :y 37 :baseline 200
:anim grandma-stand
@@ -441,10 +453,12 @@
:x 194 :y 188 :baseline 241)}
:owl (rooms/make-entity :owl (assoc (animation->texture screen owl-stand)
:x 187 :y 172 :baseline 241
:label "Owl"
:stand owl-stand
:talk owl-talk
:puke owl-puke
:eye owl-eye
:cursor :talk
:talk-color (color 0.5 0.5 1.0 1.0)
:anim owl-stand
:anim-start 0
@@ -529,5 +543,5 @@
(if (= :night (get-in entities [:state :time]))
(make-night entities)
(utils/remove-interaction entities :rock)
)))
)))
:start-pos [200 10])))

View File

@@ -15,6 +15,8 @@
[play-clj.g2d :refer :all])
(:import [com.badlogic.gdx.graphics Color]))
(println "loading " *ns*)
(defn go-to-jail [entities & [time]]
(actions/update-state entities #(assoc % :chest-contents (concat (remove #{:key :ladder} (:inventory %)) (:chest-contents %))))
@@ -27,13 +29,13 @@
:time time)
(actions/play-animation entities :ego :standup))
(defn make-wizard [screen wizard-spec]
(let [wizard-sheet (texture! (utils/get-texture "wizard/talk.png") :split 20 46)
(defn make-wizard [screen atlas wizard-spec]
(let [wizard-sheet (texture! (utils/atlas->texture atlas "wizard/talk") :split 20 46)
wizard-stand (animation 0.2 (for [i (flatten [(repeat 10 0) 1])]
(aget wizard-sheet 0 i)))
wizard-talk-angry (utils/make-anim "wizard/talk-angry.png" [20 50] 0.2 [0 2 0 2 1 2 0 3 0 2 0 1 0 2])
wizard-magic-hands (utils/make-anim "wizard/magic-hands.png" [20 50] 0.2 (range 2))
wizard-disappear (utils/make-anim "wizard/disappear.png" [20 46] 0.075 (range 19))
wizard-talk-angry (utils/make-anim atlas "wizard/talk-angry" [20 50] 0.2 [0 2 0 2 1 2 0 3 0 2 0 1 0 2])
wizard-magic-hands (utils/make-anim atlas "wizard/magic-hands" [20 50] 0.2 (range 2))
wizard-disappear (utils/make-anim atlas "wizard/disappear" [20 46] 0.075 (range 19))
disappear-left (utils/flip wizard-disappear)
wizard-talk (animation 0.2 (for [i [0 2 0 2 1 2 0 3 0 2 0 1 0 2]]
(aget wizard-sheet 0 i)))
@@ -66,6 +68,8 @@
disappear-left {1 [:disappear 0.7]}
}
:night-profile :sprite
:label "Gandarf"
:cursor :talk
:origin-x 0
:origin-y 0
:talk-color (color 0.95 0.3 1.0 1.0)
@@ -292,16 +296,18 @@
"Nevermind."
{:run #(actions/respond entities % :frankie "Come back when you've got some good valuables.")}]}))
(defn make-frankie [screen]
(let [stand (utils/make-anim "castle-gate/frankie.png" [24 35] 0.19 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
talk (utils/make-anim "castle-gate/frankie.png" [24 35] 0.2 [2 0 2 0 2 0 2 0 0 1 0])
walk (utils/make-anim-seq "castle-gate/frankie-walk" [24 35] 0.2 (range 8))
laugh (utils/make-anim "castle-gate/frankie.png" [24 35] 0.1 [1 3 4 3 4 3 4 3 4 3 4 3 4 1 0])
glance (utils/make-anim "castle-gate/frankie.png" [24 35] 0.25 [0 6 0 6 5 5 5 6 7 7 7 6 ])
reach (utils/make-anim "castle-gate/frankie.png" [24 35] 0.2 [0 8 9 9 9 9 8])
flex (utils/make-anim "castle-gate/frankie.png" [24 35] 0.2 [0 10 11 12 12 12 12 11 10])]
(defn make-frankie [screen atlas]
(let [stand (utils/make-anim atlas "frankie" [24 35] 0.19 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
talk (utils/make-anim atlas "frankie" [24 35] 0.2 [2 0 2 0 2 0 2 0 0 1 0])
walk (utils/make-anim-seq atlas "frankie-walk" [24 35] 0.2 (range 8))
laugh (utils/make-anim atlas "frankie" [24 35] 0.1 [1 3 4 3 4 3 4 3 4 3 4 3 4 1 0])
glance (utils/make-anim atlas "frankie" [24 35] 0.25 [0 6 0 6 5 5 5 6 7 7 7 6 ])
reach (utils/make-anim atlas "frankie" [24 35] 0.2 [0 8 9 9 9 9 8])
flex (utils/make-anim atlas "frankie" [24 35] 0.2 [0 10 11 12 12 12 12 11 10])]
(assoc (animation->texture screen stand)
:x 235 :y 90 :baseline 150
:label "Frankie Rockfist"
:cursor :talk
:origin-x 12
:origin-y 0
:anim stand
@@ -455,7 +461,9 @@
:bloodclot-head "Give it here!")
(actions/transition-background entities :space [200 45] :between (fn [s e]
(-> e
(assoc-in [:room :entities :ego :stand-override] :crawl-stand)
(assoc-in [:room :entities :ego :previous-frame-index] -1)
(update-in [:room :entities :ego] #(actions/start-animation s % :crawl-stand)))
))
(actions/do-dialogue entities

View File

@@ -19,19 +19,23 @@
[play-clj.g2d :refer :all])
(:import [com.badlogic.gdx.graphics Color]))
(println "loading " *ns*)
(def walk-chan (a/chan))
(defn set-opacity [entities opacity tool-opacity]
(-> entities
(assoc-in [:room :layers 0 :opacity] opacity)
(assoc-in [:room :layers 1 :opacity] opacity)
(assoc-in [:room :layers 2 :opacity] opacity)
(assoc-in [:room :layers 3 :opacity] opacity)
(assoc-in [:room :layers 4 :opacity] opacity)
(assoc-in [:room :layers 5 :opacity] opacity)
(assoc-in [:room :layers 6 :opacity] opacity)
(assoc-in [:room :layers 7 :opacity] opacity)
(assoc-in [:room :layers 8 :opacity] opacity)
(assoc-in [:room :current-layers 0 :opacity] opacity)
(assoc-in [:room :current-layers 1 :opacity] opacity)
(assoc-in [:room :current-layers 2 :opacity] opacity)
(assoc-in [:room :current-layers 3 :opacity] opacity)
(assoc-in [:room :current-layers 4 :opacity] opacity)
(assoc-in [:room :current-layers 5 :opacity] opacity)
(assoc-in [:room :current-layers 6 :opacity] opacity)
(assoc-in [:room :current-layers 7 :opacity] opacity)
(assoc-in [:room :current-layers 8 :opacity] opacity)
(assoc-in [:room :entities :fairy-godfather :label] (if (> opacity 0.0) "Fairy Godfather" nil))
(assoc-in [:room :entities :fairy-godfather :cursor] (if (> opacity 0.0) :talk nil))
(assoc-in [:room :entities :sword :opacity] tool-opacity)
(assoc-in [:room :entities :case :opacity] tool-opacity)
(assoc-in [:room :entities :broom :opacity] tool-opacity)
@@ -47,13 +51,13 @@
(begin [this screen entities]
(-> entities
(assoc-in [:tweens :fade-in]
(tween/tween :fade-in screen [:room :layers 0 :opacity] 0.0 1.0 0.5 :ease tween/ease-in-out-quintic))))
(tween/tween :fade-in screen [:room :current-layers 0 :opacity] 0.0 1.0 0.5 :ease tween/ease-in-out-quintic))))
(continue [this screen entities]
(set-opacity entities (get-in entities [:room :layers 0 :opacity] ) 0.0))
(set-opacity entities (get-in entities [:room :current-layers 0 :opacity] ) 0.0))
(done? [this screen entities]
(= 1.0 (get-in entities [:room :layers 0 :opacity])))
(= 1.0 (get-in entities [:room :current-layers 0 :opacity])))
(terminate [this screen entities]
entities)
@@ -363,13 +367,15 @@
:fairy-godfather "Imagine the sweet smell of victory once you've mopped up some spilled milk."
:fairy-godfather "Or the smell of soap in the bathroom, where you'll spend your time making the tile and porcelain shine."))
(defn make [screen]
(let [fairy-godfather-anim (utils/make-anim "dream/fairy-godfather.png" [63 77] 0.15 [0 1 2 3 2 1 0 1 4 3 2 1])
fairy-godfather-talk-anim (utils/make-anim "dream/fairy-godfather.png" [63 77] 0.15 [5 6 7 8 7 6])
fairy-godfather-magic-anim (utils/make-anim "dream/fairy-godfather-magic.png" [100 77] 0.15 [0 1 2 3 4 4 4 4 3 2 1 0])]
(rooms/make :music {:intro :wind :day :dream}
(defn make [screen atlas global-atlas]
(let [fairy-godfather-anim (utils/make-anim atlas "fairy-godfather" [63 77] 0.15 [0 1 2 3 2 1 0 1 4 3 2 1])
fairy-godfather-talk-anim (utils/make-anim atlas "fairy-godfather" [63 77] 0.15 [5 6 7 8 7 6])
fairy-godfather-magic-anim (utils/make-anim atlas "fairy-godfather-magic" [100 77] 0.15 [0 1 2 3 4 4 4 4 3 2 1 0])]
(rooms/make
:name "Dream"
:interactions {:pit {:box [54 0 219 36]
:label "Pit of destiny"
:cursor :look
:script (actions/get-script entities
(actions/walk-to entities :ego [154 41])
(actions/talk entities :ego "Wow! That's a long way down."))
@@ -401,21 +407,32 @@
:ego "It seems like misery!"
:ego "Plus, how can I ever win the heart of my true love, Georgia McGorgeous?"))}}}
:timers {:return [1.0 1.0 return-from-island]}
:layers [(assoc (utils/get-texture "dream/sky.png") :x 0 :y 0 :baseline -3 :parallax 0.01)
(assoc (utils/get-texture "dream/far.png") :x -10 :y 0 :baseline -2 :parallax 0.01)
(assoc (utils/get-texture "dream/clouds1.png") :x -10 :y 0 :baseline -1 :parallax 0.2 :scale-x 1.1 :scale-y 1.1)
(assoc (utils/get-texture "dream/island.png") :x 180 :y 180 :baseline 0 :parallax 0.3 :scale-x 1.1 :scale-y 1.1)
(assoc (utils/get-texture "dream/cliff.png") :x 50 :y 133 :baseline 1 :parallax 0.6 :scale-x 1.2 :scale-y 1.2)
(assoc (utils/get-texture "dream/background.png") :x 0 :y 0 :baseline 2)
(assoc (utils/get-texture "dream/corner-l.png") :x -10 :y -10 :baseline 240 :parallax 2.0 )
(assoc (utils/get-texture "dream/corner-r.png") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2)
(assoc (utils/get-texture "dream/pedestals.png") :x 0 :y 0 :baseline 139)]
:layers [(assoc (utils/atlas->texture atlas "sky") :x 0 :y 0 :baseline -3 :parallax 0.5)
(assoc (utils/atlas->texture atlas "far") :x -10 :y 0 :baseline -2 :origin-x 160 :parallax 0.5)
(assoc (utils/atlas->texture atlas "clouds1") :x -10 :y 0 :baseline -1 :parallax 0.2 :scale-x 1.1 :scale-y 1.1)
(assoc (utils/atlas->texture atlas "island") :x 180 :y 180 :baseline 0 :parallax 0.3 :scale-x 1.1 :scale-y 1.1)
(assoc (utils/atlas->texture atlas "cliff") :x 50 :y 133 :baseline 1 :parallax 0.6 :scale-x 1.2 :scale-y 1.2)
(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 2)
(assoc (utils/atlas->texture atlas "corner-l") :x -10 :y -10 :baseline 240 :parallax 2.0 )
(assoc (utils/atlas->texture atlas "corner-r") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2)
(assoc (utils/atlas->texture atlas "pedestals") :x 0 :y 0 :baseline 139)]
:current-layers [(assoc (utils/atlas->texture atlas "sky") :x 160 :y 120 :origin-y 120 :baseline -3 :origin-x 160 :parallax 0.01)
(assoc (utils/atlas->texture atlas "far") :x 160 :y 120 :baseline -2 :origin-y 120 :origin-x 160 :parallax 0.01)
(assoc (utils/atlas->texture atlas "clouds1") :x 150 :y 120 :baseline -1 :origin-x 160 :origin-y 120 :parallax 0.1 :scale-x 1.1 :scale-y 1.1)
(assoc (utils/atlas->texture atlas "island") :x 180 :y 180 :origin-x 15 :origin-y 10 :baseline 0 :parallax 0.2 :scale-x 1.1 :scale-y 1.1)
(assoc (utils/atlas->texture atlas "cliff") :x 160 :y 120 :origin-x 160 :origin-y 120 :baseline 1 :parallax 0.6 :scale-x 1.2 :scale-y 1.2)
(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 2)
(assoc (utils/atlas->texture atlas "corner-l") :x -10 :y -10 :baseline 240 :parallax 2.0 )
(assoc (utils/atlas->texture atlas "corner-r") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2)
(assoc (utils/atlas->texture atlas "pedestals") :x 0 :y 0 :baseline 139)]
:entities {:magic (assoc (particle-effect "particles/dream-magic") :x 160 :y 80 :baseline 240)
:clouds (assoc (particle-effect "particles/cloudy2") :x 160 :y 120 :baseline 241)
:case (assoc (utils/get-texture "dream/case.png")
:case (assoc (utils/atlas->texture atlas "case")
:x 144 :y 122 :baseline 139
:label "Glass case"
:cursor :look
:script (actions/get-script entities
(read-sword-plaque entities))
:scripts {:shovel (actions/get-script entities
@@ -439,9 +456,9 @@
(actions/walk-straight-to entities :ego [180 100] :anim :jumping-straight :update-baseline? false :stop? false :speed 2.0)
(actions/walk-straight-to entities :ego [190 30] :anim :jumping-straight :update-baseline? false :stop? false :speed 3.0)
(actions/walk-straight-to entities :ego [200 -80] :anim :jumping-straight :update-baseline? false :stop? false :speed 8.0)
(actions/remove-item entities :dream-sword)
(actions/remove-item entities :broom)
(actions/remove-item entities :shovel)
(actions/remove-item entities :dream-sword :quiet? true)
(actions/remove-item entities :broom :quiet? true)
(actions/remove-item entities :shovel :quiet? true)
(actions/transition-background entities :inside-castle [92 150] :time 8.0)
(actions/resume-camera entities)
(actions/walk-straight-to entities :ego [79 145] :stop? false)
@@ -462,15 +479,17 @@
(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 (utils/get-texture "dream/sword.png")
:sword (assoc (utils/atlas->texture atlas "sword")
:x 144 :y 122 :baseline 139)
:explode (assoc (particle-effect "particles/explode") :x 150 :y 138 :baseline 240)
:broom (assoc (utils/get-texture "dream/broom.png") :x 286 :y 122
:broom (assoc (utils/atlas->texture atlas "broom") :x 286 :y 122
:path (catmull-rom-spline (map #(apply vector-2* %) [[286 122] [286 128]]) true)
:update-fn (partial utils/update-path-location 0.30)
:baseline 240
:label "Broom"
:cursor :hand
:script (actions/get-script entities
(if ((get-in @entities [:state :plaques-read]) :broom)
(do
@@ -481,11 +500,13 @@
(actions/give entities :broom))
(read-broom-plaque entities))))
:shovel (assoc (utils/get-texture "dream/shovel.png") :x 33 :y 122
:shovel (assoc (utils/atlas->texture atlas "shovel") :x 33 :y 122
:path (catmull-rom-spline (map #(apply vector-2* %) [[22 122] [22 128]]) true)
:update-fn (partial utils/update-path-location 0.33)
:baseline 240
:label "Shovel"
:cursor :hand
:script (actions/get-script entities
(if ((get-in @entities [:state :plaques-read]) :shovel)
(do
@@ -496,10 +517,10 @@
(actions/give entities :shovel))
(read-shovel-plaque entities))))
:sign (assoc (utils/get-texture "dream/sign.png") :x 229 :y 33 :baseline 207)
:plaque-1 (assoc (utils/get-texture "dream/plaque1.png") :x 39 :y 99 :baseline 139 :script (actions/get-script entities (read-shovel-plaque entities)))
:plaque-2 (assoc (utils/get-texture "dream/plaque2.png") :x 147 :y 104 :baseline 139 :script (actions/get-script entities (read-sword-plaque entities)))
:plaque-3 (assoc (utils/get-texture "dream/plaque3.png") :x 283 :y 98 :baseline 139 :script (actions/get-script entities (read-broom-plaque entities)))
:sign (assoc (utils/atlas->texture atlas "sign") :x 229 :y 33 :baseline 207)
:plaque-1 (assoc (utils/atlas->texture atlas "plaque1") :x 39 :y 99 :baseline 139 :label "Plaque" :cursor :look :script (actions/get-script entities (read-shovel-plaque entities)))
:plaque-2 (assoc (utils/atlas->texture atlas "plaque2") :x 147 :y 104 :baseline 139 :label "Plaque" :cursor :look :script (actions/get-script entities (read-sword-plaque entities)))
:plaque-3 (assoc (utils/atlas->texture atlas "plaque3") :x 283 :y 98 :baseline 139 :label "Plaque" :cursor :look :script (actions/get-script entities (read-broom-plaque entities)))
:outside-particles (common/make-outside-particles)
:bounce-surrogate {:object nil
:path (catmull-rom-spline (map #(apply vector-2* %) [[200 130] [200 150]]) true)
@@ -539,8 +560,11 @@
:default {:origin-x 31}}
:facing :left
:update-fn (fn [s es e]
(assoc-in e [:offset-y] (* (:scale-y e) (get-in es [:bounce-surrogate :delta-y] 0))))
:talk-color (Color/valueOf "ADA6FFFF")
:label "Fairy godfather"
:cursor :talk
:script (actions/get-script entities
(if (get-in @entities [:room :entities :fairy-godfather :distracted?])
(actions/do-dialogue entities :ego "He wouldn't be able to hear me from there.")
@@ -564,7 +588,7 @@
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(if (get-in entities [:state :seen-intro?])
(if (get-in entities [:state :seen-intro?])
(set-opacity entities 1.0 1.0)
(set-opacity entities 0.0 0.0))
(if (actions/has-item? entities :broom)

View File

@@ -17,40 +17,41 @@
[play-clj.g2d :refer :all])
(:import [com.badlogic.gdx.graphics Color]))
(defn make [screen]
(let [
peddler-sheet (texture! (utils/get-texture "outside-castle/peddler-talk.png" ) :split 18 36)
(println "loading " *ns*)
(defn make [screen atlas global-atlas]
(let [peddler-sheet (texture! (utils/atlas->texture atlas "peddler-talk" ) :split 18 36)
peddler-stand (utils/flip (animation 0.2 (for [i (flatten [(repeat 8 0) 6 (repeat 8 0) 6 (repeat 5 0) 4 5 4 5 4 5])]
(aget peddler-sheet 0 i))))
warden-stand (utils/make-anim "ending-castle/warden-2.png" [21 41] 0.21 (flatten [(repeat 7 0) 1]))
warden-stand (utils/make-anim atlas "warden-2" [21 41] 0.21 (flatten [(repeat 7 0) 1]))
game-player-stand (utils/make-anim "ending-castle/game-player.png" [14 39] 0.2 (flatten [(repeat 5 0) 1] ))
game-player-stand (utils/make-anim atlas "game-player" [14 39] 0.2 (flatten [(repeat 5 0) 1] ))
ladder-guard-stand-1 (animation 0.1 [(utils/get-texture "inside-cafeteria/ladder-guard-2.png")])
ladder-guard-stand-2 (utils/flip (animation 0.1 [(utils/get-texture "inside-cafeteria/ladder-guard-2.png")]))
grandma-stand (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
cat-stand (utils/make-anim "cat-tree/cat-stand.png" [22 10] 0.15 (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0]))
duke-stand (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 (flatten [(repeat 4 0) 1]))
duke-talk (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 [0 2 0 2 1 2])
duke-reach (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 [3 4 5 6])
duke-reach-talk (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 [6 7])
duke-knight (utils/make-anim "ending-castle/duke.png" [40 48] 0.23 [8 9 10 9 8])
ladder-guard-stand-1 (animation 0.1 [(utils/atlas->texture atlas "ladder-guard-2")])
ladder-guard-stand-2 (utils/flip (animation 0.1 [(utils/atlas->texture atlas "ladder-guard-2")]))
grandma-stand (utils/make-anim atlas "grandma" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
cat-stand (utils/make-anim atlas "cat-stand" [22 10] 0.15 (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0]))
duke-stand (utils/make-anim atlas "duke" [40 48] 0.23 (flatten [(repeat 4 0) 1]))
duke-talk (utils/make-anim atlas "duke" [40 48] 0.23 [0 2 0 2 1 2])
duke-reach (utils/make-anim atlas "duke" [40 48] 0.23 [3 4 5 6])
duke-reach-talk (utils/make-anim atlas "duke" [40 48] 0.23 [6 7])
duke-knight (utils/make-anim atlas "duke" [40 48] 0.23 [8 9 10 9 8])
georgia-stand (utils/make-anim "georgia/stand.png" [20 43] 0.2 (flatten [(repeat 20 0) 1 (repeat 10 0) 1]))
georgia-hand-hold (utils/make-anim "georgia/stand.png" [20 43] 0.2 (flatten [(repeat 3 0) 3 4]))
georgia-talk (utils/make-anim "georgia/stand.png" [20 43] 0.2 (flatten [0 2 0 2 0 1 0 0 2]))
georgia-kick (utils/make-anim-seq "georgia/kick" [40 43] 0.1 (flatten [(repeat 10 0) (repeat 7 1) (repeat 7 2)
georgia-stand (utils/make-anim atlas "georgia/stand" [20 43] 0.2 (flatten [(repeat 20 0) 1 (repeat 10 0) 1]))
georgia-hand-hold (utils/make-anim atlas "georgia/stand" [20 43] 0.2 (flatten [(repeat 3 0) 3 4]))
georgia-talk (utils/make-anim atlas "georgia/stand" [20 43] 0.2 (flatten [0 2 0 2 0 1 0 0 2]))
georgia-kick (utils/make-anim-seq atlas "georgia/kick" [40 43] 0.1 (flatten [(repeat 10 0) (repeat 7 1) (repeat 7 2)
3 4 5 6 7 8 9 10 11 12 13 (repeat 10 14)
15 16 17 18 19 (repeat 10 0)]))
frankie-fall (utils/make-anim-seq "ending-castle/frankie-fall" [40 35] 0.1 (flatten [(range 8) (repeat 20 7) 8 9 10 11 7]))
frankie-down (utils/make-anim-seq "ending-castle/frankie-fall" [40 35] 0.1 [0])
frankie-fall (utils/make-anim-seq atlas "frankie-fall" [40 35] 0.1 (flatten [(range 8) (repeat 20 7) 8 9 10 11 7]))
frankie-down (utils/make-anim-seq atlas "frankie-fall" [40 35] 0.1 [0])
scaler (utils/scaler-fn-with-baseline 20 1.3 1.30)]
(rooms/make :music :dream
(rooms/make
:sounds {:cloud (utils/load-sound "ending-castle/cloud.ogg")}
:name "Ending"
:interactions {}
:layers [(assoc (utils/get-texture "ending-castle/ending-castle2-assets/background.png") :x 0 :y 0 :origin-x 0 :origin-y 0 :baseline 0)
(assoc (utils/get-texture "ending-castle/ending-castle2-assets/foreground.png") :x 160 :y 0 :origin-x 165 :origin-y 5 :baseline 240 :parallax 1.4)]
:layers [(assoc (utils/atlas->texture atlas "ending-castle2-assets/background") :x 0 :y 0 :origin-x 0 :origin-y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "ending-castle2-assets/foreground") :x 160 :y 0 :origin-x 165 :origin-y 5 :baseline 240 :parallax 1.4)]
:apply-state (fn [screen e]
(as-> e e
(utils/play-sound! screen e :cloud (fn [e]
@@ -70,14 +71,14 @@
:stand georgia-stand
:talk georgia-talk
:kick georgia-kick
:walk (utils/make-anim "georgia/walk.png" [20 43] 0.2 (range 8))
:walk (utils/make-anim atlas "georgia/walk" [20 43] 0.2 (range 8))
:hand-hold georgia-hand-hold
:kick-sound (utils/load-sound "georgia/kick.ogg")
:anim-sound-frames {georgia-kick {27 [:kick-sound (constantly 0.6)]}}
:anim-merges {georgia-stand {:origin-x 10 :origin-y 1}
:default {:origin-x 10 :origin-y 1}
georgia-kick {:origin-x 19 :origin-y 0}}))
:entities {:frankie (assoc (common/make-frankie screen)
:entities {:frankie (assoc (common/make-frankie screen global-atlas)
:x 28 :y 21 :baseline 200
:fall frankie-fall
:down frankie-down
@@ -88,7 +89,7 @@
:anim-merges {:default {:origin-x 12 :origin-y 0}
frankie-fall {:origin-x 22 :origin-y 0}
frankie-down {:origin-x 22 :origin-y 0}})
:gandarf (assoc (common/make-wizard screen {:x 205 :y 400 :baseline 239})
:gandarf (assoc (common/make-wizard screen global-atlas {:x 205 :y 400 :baseline 239})
:update-fn (fn [screen entities gandarf]
(assoc gandarf :y (or (get-in entities [:gandarf-cloud :y])
(:y gandarf)))))
@@ -119,22 +120,22 @@
:scale-x 0.65
:scale-y 0.65
:scaled true)
:crowd-left (assoc (utils/get-texture "ending-castle/crowd-left.png")
:crowd-left (assoc (utils/atlas->texture atlas "crowd-left")
:x 0 :y 0
:scale-x 1.3
:scale-y 1.3
:baseline 239)
:crowd-right (assoc (utils/get-texture "ending-castle/crowd-right.png")
:crowd-right (assoc (utils/atlas->texture atlas "crowd-right")
:x 196 :y 0
:scale-x 1.3
:scale-y 1.3
:baseline 238)
:guard-1 (assoc (utils/get-texture "ending-castle/guard-1.png")
:guard-1 (assoc (utils/atlas->texture atlas "guard-1")
:x 91 :y 73
:scale-x 0.9
:scale-y 0.9
:baseline 140)
:guard-2 (assoc (utils/get-texture "ending-castle/guard-2.png")
:guard-2 (assoc (utils/atlas->texture atlas "guard-2")
:x 182 :y 73
:scale-x 0.9
:scale-y 0.9

View File

@@ -15,6 +15,7 @@
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn bloodclot-choices [entities]
@@ -56,12 +57,13 @@
(actions/get-script entities
(actions/talk entities who msg)))
(defn make [screen]
(let [bloodclot-talk (utils/make-anim-seq "held/bloodclot-head" [114 82] 0.1 [0 1 2 1 0 3 3 0 1 2 1 0 3 4 5 6 5 3 3 1 2 1 3 3 3 3 3 0 0 0 7 8 7])
bloodclot-stand (utils/make-anim-seq "held/bloodclot-head" [114 82] 0.1 (flatten [(repeat 15 0) 7 8 7]))]
(rooms/make :music :fight
:name "Held"
(defn make [screen atlas global-atlas]
(let [bloodclot-talk (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 [0 1 2 1 0 3 3 0 1 2 1 0 3 4 5 6 5 3 3 1 2 1 3 3 3 3 3 0 0 0 7 8 7])
bloodclot-stand (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 (flatten [(repeat 15 0) 7 8 7]))]
(rooms/make :name "Held"
:interactions {:bloodclot {:box [182 42 270 196]
:label "Bloodclot"
:cursor :talk
:script (actions/get-script entities
(bloodclot-talk-script entities))
:scripts #(condp = %
@@ -79,8 +81,8 @@
(actions/talk entities :bloodclot-head "Don't make me laugh, kid!")))
}}
:timers {:taunt [5.0 1.0 add-second]}
:layers [(assoc (utils/get-texture "held/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "held/hand.png") :x 0 :y 0 :baseline 240)]
:layers [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "hand") :x 0 :y 0 :baseline 240)]
:entities {:bloodclot-head (assoc (animation->texture screen bloodclot-stand)
:x 211 :y 115 :baseline 240
:origin-x 57 :origin-y 0

View File

@@ -11,6 +11,7 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(def boy-names
["Steve" "Bob" "Bud" "Clement" "Terrence" "Flapjack" "Ticklemonster" "Peter" "Greg" "Dave" "Stu" "Calsbad" "Fatso" "Tanner" "Klug"
"Griswold" "Leonardo" "Donatello" "Raphael" "Michelangelo" "Francis" "Ebeneezer" "Pierre" "Finn" "Slade" "Gilbert" "Graham"
@@ -159,20 +160,25 @@
(actions/walk-to entities :ego [143 58] :face :left)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :portrait (get-in @entities [:room :portrait]))
(actions/remove-item entities :portrait))
(actions/remove-item entities :portrait)
(actions/remove-entity entities :return-portrait)
(actions/remove-entity entities :return-portrait-2))
(defn get-portrait [entities]
(actions/walk-to entities :ego [140 58] :face :left)
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :portrait)
(actions/give entities :portrait)
(actions/talk entities :ego "It's a portrait. There's something on the back but it's too dim to read."))
(actions/talk entities :ego "It's a portrait. There's something on the back but it's too dim to read.")
(actions/add-entity entities :return-portrait-2 (get-in @entities [:room :return-portrait-2]))
(actions/add-entity entities :return-portrait (get-in @entities [:room :return-portrait])))
(defn return-teddy [entities]
(actions/walk-to entities :ego [242 49] :face :right)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :teddy (get-in @entities [:room :teddy]))
(actions/remove-item entities :teddy))
(actions/remove-item entities :teddy)
(actions/remove-entity entities :return-teddy))
(defn has-to-return-teddy? [entities]
(and (actions/has-item? entities :teddy)
@@ -191,22 +197,25 @@
(assoc-in [:room :entities :darken :opacity] 0.4)
(assoc-in [:room :entities :glow :opacity] 0.0))))
(defn make [screen]
(let [shopkeep-sheet (texture! (utils/get-texture "inside-antique/shopkeep-talk.png") :split 18 21)
(defn make [screen atlas global-atlas]
(let [shopkeep-sheet (texture! (utils/atlas->texture atlas "shopkeep-talk") :split 18 21)
shopkeep-stand (animation 0.1 (for [i (flatten [(repeat 30 0) 1 (repeat 50 0) 1 0 1 0])]
(aget shopkeep-sheet 0 i)))
shopkeep-talk (animation 0.15 (for [i [0 2 0 2 0 3 1 0]]
(aget shopkeep-sheet 0 i)))
shopkeep-sigh (utils/make-anim "inside-antique/antique-sigh.png" [24 21] 0.12 (flatten [ (range 9) 0 0 ]))
shopkeep-sigh (utils/make-anim atlas "antique-sigh" [24 21] 0.12 (flatten [ (range 9) 0 0 ]))
beard (utils/make-anim "inside-antique/beard.png" [28 54] 0.5 [0 1 0 2])
teddy (assoc (utils/get-texture "inside-antique/teddy.png")
beard (utils/make-anim atlas "beard" [28 54] 0.5 [0 1 0 2])
teddy (assoc (utils/atlas->texture atlas "teddy")
:x 255
:y 95
:baseline 160
:label "Choicest teddy bear"
:cursor :hand
:script (actions/get-script entities
(actions/walk-to entities :ego [242 49] :face :right)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :return-teddy (get-in @entities [:room :return-teddy]))
(actions/give entities :teddy)
(actions/remove-entity entities :teddy)
(when (not (get-in @entities [:state :allowed-to-keep-teddy?]))
@@ -215,16 +224,49 @@
:shopkeep "Don't get any fast ideas."
:shopkeep "That teddy bear does not leave my store."
:shopkeep "My son would be stricken with grief to find it missing."))))]
(rooms/make :music :inside-antique
(rooms/make
:name "Antique shop"
:sounds {:fire-1 (utils/load-sound "inside-antique/fire-1.ogg")
:fire-2 (utils/load-sound "inside-antique/fire-2.ogg")
:fire-3 (utils/load-sound "inside-antique/fire-3.ogg")
}
:return-portrait (rooms/make-entity :return-portrait {:box [103 70 206 116]
:label "Desk"
:baseline 0
:cursor :look
:script (actions/get-script entities (actions/talk entities :ego "It's the shopkeep's desk."))
:scripts {:portrait (actions/get-script entities
(return-portrait entities))
:teddy (actions/get-script entities
(return-teddy entities))}})
:return-portrait-2 (rooms/make-entity :return-portrait-2
{:box [103 116 131 131]
:label "Desk"
:baseline 0
:cursor :look
:script (actions/get-script entities (if (actions/has-item? entities :portrait)
(actions/talk entities :ego "The shopkeep's portrait used to sit there.")
(get-portrait entities)
))
:scripts {:portrait (actions/get-script entities
(return-portrait entities))
:teddy (actions/get-script entities
(return-teddy entities))}})
:return-teddy (rooms/make-entity :return-teddy {:box [227 90 301 105]
:baseline 0
:cursor :look
:label "Shelf"
:script (actions/get-script entities
(actions/talk entities :ego "It's a shelf."))
:scripts {:teddy (actions/get-script entities
(return-teddy entities))
:portrait (actions/get-script entities
(return-portrait entities))}})
:interactions
{:right {:box [250 0 320 75]
:cursor :right
:script (actions/get-script entities
:only-script (actions/get-script entities
(when (or (actions/has-item? entities :portrait)
(has-to-return-teddy? entities))
(actions/walk-to entities :ego [235 15])
@@ -238,30 +280,12 @@
(actions/walk-straight-to entities :ego [320 -5])
(actions/transition-background entities :inside-castle [182 90])
(actions/walk-to entities :ego [187 75]))}
:return-portrait-2 {:box [103 116 131 131]
:script (actions/get-script entities (if (actions/has-item? entities :portrait)
(actions/talk entities :ego "The shopkeep's portrait used to sit there.")
(get-portrait entities)
))
:scripts {:portrait (actions/get-script entities
(return-portrait entities))
:teddy (actions/get-script entities
(return-teddy entities))}}
:return-portrait {:box [103 70 206 116]
:script (actions/get-script entities (actions/talk entities :ego "It's the shopkeep's desk."))
:scripts {:portrait (actions/get-script entities
(return-portrait entities))
:teddy (actions/get-script entities
(return-teddy entities))}}
:return-teddy {:box [227 90 301 105]
:script (actions/get-script entities
(actions/talk entities :ego "It's a shelf."))
:scripts {:teddy (actions/get-script entities
(return-teddy entities))
:portrait (actions/get-script entities
(return-portrait entities))}}
:window {:box [195 121 256 190]
:label "Window"
:cursor :hand
:script (actions/get-script entities
(actions/walk-to entities :ego [207 68] :face :right)
@@ -294,29 +318,39 @@
(actions/play-animation entities :ego :hold-up-to-window)
(actions/talk entities :ego "It's just too dim."))))}}
:grandfather-clock {:box [55 70 103 185]
:label "Grandfather clock"
:cursor :look
:script (actions/get-script entities
(actions/do-dialogue entities :ego "Cool grandfather clock!"
:shopkeep "It's quite the exquisite piece, isn't it?"))}
:shelf {:box [0 60 52 199]
:cursor :look
:label "Trinkets"
:script (actions/get-script entities
(actions/walk-to entities :ego [48 58])
(actions/talk entities :ego "All of these trinkets seem too bulky to fit in my pack."))}
:flowers {:box [178 115 188 143]
:label "Flowers"
:cursor :look
:script (actions/get-script entities
(actions/talk entities :ego "I've never been a fan of flowers."))}
:lian {:box [264 103 317 198]
:cursor :look
:label "Tapestry"
:script (actions/get-script entities
(actions/walk-to entities :ego [220 35] :face :right)
(actions/do-dialogue entities
:ego "It's a tapestry of Rupert the Lion!"
:ego "He's the town of Remington's mascot."))}
}
:layers [(assoc (utils/get-texture "inside-antique/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "inside-antique/desk.png") :x 0 :y 0 :baseline 113)
:layers [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "desk") :x 0 :y 0 :baseline 113)
(assoc (utils/get-texture "inside-antique/fg.png") :x 0 :y 0 :baseline 320 :parallax 1.5)
(assoc (utils/atlas->texture atlas "fg") :x 0 :y 0 :baseline 320 :parallax 1.5)
]
:entities {:shopkeep (actions/start-animation screen (assoc (animation->texture screen shopkeep-stand) :x 148 :y 122 :baseline 112
:label "Shopkeeper"
:cursor :talk
:stand shopkeep-stand
:scale-x 1.6
:scale-y 1.6
@@ -348,10 +382,10 @@
(actions/get-script entities
(actions/talk entities :shopkeep "No thanks, sonny."))))
:stand)
:glow (assoc (utils/get-texture "inside-antique/glow.png") :x 0 :y 0 :baseline 240 :additive? true :opacity 0.3)
:closed-blinds (assoc (utils/get-texture "inside-antique/closed-blinds.png") :x 0 :y 0 :baseline 0 :opacity 1.0)
:open-blinds (assoc (utils/get-texture "inside-antique/open-blinds.png") :x 0 :y 0 :baseline 0 :opacity 0.0)
:darken (assoc (utils/get-texture "inside-antique/darken.png") :x 0 :y 0 :baseline 321 :opacity 0.4 )
:glow (assoc (utils/atlas->texture atlas "glow") :x 0 :y 0 :baseline 240 :additive? true :opacity 0.3)
:closed-blinds (assoc (utils/atlas->texture atlas "closed-blinds") :x 0 :y 0 :baseline 1 :opacity 1.0)
:open-blinds (assoc (utils/atlas->texture atlas "open-blinds") :x 0 :y 0 :baseline 1 :opacity 0.0)
:darken (assoc (utils/atlas->texture atlas "darken") :x 0 :y 0 :baseline 321 :opacity 0.4 )
:beard (assoc (animation->texture screen beard)
:anim beard
:anim-start 0
@@ -364,14 +398,16 @@
:fire-particle (doto (assoc (particle-effect "particles/fire-particle") :x 162 :y 104
:baseline 240)
(particle-effect! :set-position 162 104))
:bowl (assoc (utils/get-texture "inside-antique/bowl.png")
:images [(utils/get-texture "inside-antique/bowl-0.png")
(utils/get-texture "inside-antique/bowl-1.png")
(utils/get-texture "inside-antique/bowl-2.png")
(utils/get-texture "inside-antique/bowl-3.png")]
:bowl (assoc (utils/atlas->texture atlas "bowl")
:images [(utils/atlas->texture atlas "bowl-0")
(utils/atlas->texture atlas "bowl-1")
(utils/atlas->texture atlas "bowl-2")
(utils/atlas->texture atlas "bowl-3")]
:x 165
:y 110
:baseline 125
:label "Mint bowl"
:cursor :hand
:script (actions/get-script entities
(if (= 3 (get-in @entities [:state :mints-eaten]))
(do (actions/walk-to entities :ego [159 58] :face :right)
@@ -415,10 +451,12 @@
:shopkeep "Pronto!"))))))
:teddy teddy}
:portrait (rooms/make-entity :portrait
(assoc (utils/get-texture "inside-antique/portrait.png")
(assoc (utils/atlas->texture atlas "portrait")
:x 112
:y 114
:baseline 120
:cursor :hand
:label "Portrait"
:script (actions/get-script entities
(get-portrait entities))))
:teddy (rooms/make-entity :teddy teddy)
@@ -431,6 +469,17 @@
(update-in entities [:room :entities] #(dissoc % :teddy))
entities)
(if (actions/has-item? entities :portrait)
(update-in entities [:room :entities] assoc
:return-portrait (get-in entities [:room :return-portrait])
:return-portrait-2 (get-in entities [:room :return-portrait-2]))
entities)
(if (actions/has-item? entities :teddy)
(update-in entities [:room :entities] assoc
:return-teddy (get-in entities [:room :return-teddy]))
entities)
(update-in entities
[:room :entities :bowl]
(fn [b]

View File

@@ -11,8 +11,10 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn make-fight-entity []
(assoc (utils/get-texture "black.png")
(println "loading " *ns*)
(defn make-fight-entity [global-atlas]
(assoc (utils/atlas->texture global-atlas "black.png")
:x 0
:y 0
:scale-x 21
@@ -171,22 +173,15 @@
(defn pace [xs speed]
(mapcat #(repeat (- 4 speed) %) xs))
(defn make [screen]
(let [#_#_warriors-stand-sheet (texture! (utils/get-texture "inside-cafeteria/warriors-stand.png") :split 66 126)
#_#_warriors-stand (animation 0.2 (for [i [0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 2 2 2 2 3 3 3 0 0 0 2 2 2 ]]
(aget warriors-stand-sheet 0 i)))
#_#_ladder-guard-sheet (texture! (utils/get-texture "inside-cafeteria/ladder-guard.png") :split 37 87)
#_#_ladder-guard-stand (animation 0.1 [(aget ladder-guard-sheet 0 0)])
ladder-guard-stand (animation 0.1 [(utils/get-texture "inside-cafeteria/ladder-guard-2.png")])
ladder-guard-talk (animation 0.1 [ (utils/get-texture "inside-cafeteria/ladder-guard-2.png")])
warriors-stand (utils/make-anim "inside-cafeteria/knights-stand.png" [49 80] 0.6 (take 100 (repeatedly #(rand-int 10))))
knight-a-stand (utils/make-anim "inside-cafeteria/knight-a.png" [70 85] 0.2 (flatten [(repeat 3 [(repeat 7 0) (repeat 7 1) (repeat 7 0) (repeat 7 2)]) [3 4 5 6 7 8 9]]))
(defn make [screen atlas global-atlas]
(let [ladder-guard-stand (animation 0.1 [(utils/atlas->texture atlas "ladder-guard-2")])
ladder-guard-talk (animation 0.1 [ (utils/atlas->texture atlas "ladder-guard-2")])
warriors-stand (utils/make-anim atlas "knights-stand" [49 80] 0.6 (take 100 (repeatedly #(rand-int 10))))
knight-a-stand (utils/make-anim atlas "knight-a" [70 85] 0.2 (flatten [(repeat 3 [(repeat 7 0) (repeat 7 1) (repeat 7 0) (repeat 7 2)]) [3 4 5 6 7 8 9]]))
#_#_ladder-guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]]
(aget ladder-guard-sheet 0 i)))
hands-fight-win (utils/make-anim-seq "inside-cafeteria/fight-new-assets/fight" [256 192] 0.025 (flatten [(pace [0 1 0 4 0 1 0 4 0 1 0 4 0 1 0 4 0 1 0 4 0 0 1 1 1 1 0 0 0 4 0 1 1 1 1 1 1 1 1 4 0 4 0 4 0 4 5 5 5 5 5 4 4 4] 0)
hands-fight-win (utils/make-anim-seq atlas "fight-new-assets/fight" [256 192] 0.025 (flatten [(pace [0 1 0 4 0 1 0 4 0 1 0 4 0 1 0 4 0 1 0 4 0 0 1 1 1 1 0 0 0 4 0 1 1 1 1 1 1 1 1 4 0 4 0 4 0 4 5 5 5 5 5 4 4 4] 0)
(pace (flatten (repeat 6 [12 13])) 0)
(pace (flatten (repeat 15 [7 8])) 0)
(pace (flatten (repeat 15 [9])) 0)
@@ -202,25 +197,26 @@
(pace (flatten (repeat 6 [12 13])) 0)
(pace [0 0 0 0 2 1 1 2 2 1 1 2 2 2 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3] 0)]))
hands-fight-lose (utils/make-anim-seq "inside-cafeteria/fight-new-assets/fight" [256 192] 0.1 (flatten [4 4 4 4 4 4 0 0 0 0 4 4 4 0 0 0 5 5 5 6 6 6 6 6 6]))]
(rooms/make :music :town-1
:name "Cafeteria"
hands-fight-lose (utils/make-anim-seq atlas "fight-new-assets/fight" [256 192] 0.1 (flatten [4 4 4 4 4 4 0 0 0 0 4 4 4 0 0 0 5 5 5 6 6 6 6 6 6]))]
(rooms/make :name "Cafeteria"
:interactions
{:right-dir {:box [272 45 320 120]
:script (actions/get-script
:only-script (actions/get-script
entities
(actions/walk-to entities :ego [319 50] :skip-type :end)
(actions/transition-background entities :inside-castle [65 150])
(actions/walk-to entities :ego [126 80] :skip-type :end))
:cursor :right}
}
:layers [(assoc (utils/get-texture "inside-cafeteria/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "inside-cafeteria/doorway.png") :x 306 :y 34 :baseline 202)
(assoc (utils/get-texture "inside-cafeteria/glow.png") :y 0 :baseline 240 :additive? true :opacity 0.3)
(assoc (utils/get-texture "inside-cafeteria/fg.png") :x 10 :y 0 :scale-x 1.1 :scale-y 1.0 :baseline 320 :parallax 1.5)
:layers [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "doorway") :x 306 :y 34 :baseline 202)
(assoc (utils/atlas->texture atlas "glow") :y 0 :baseline 240 :additive? true :opacity 0.3)
(assoc (utils/atlas->texture atlas "fg") :x 10 :y 0 :scale-x 1.1 :scale-y 1.0 :baseline 320 :parallax 1.5)
]
:entities {:warriors (actions/start-animation screen (assoc (animation->texture screen warriors-stand) :x 31 :y 36 :baseline 180
:cursor :talk
:label "Knights"
:left {:stand (utils/flip warriors-stand)
:talk (utils/flip warriors-stand)}
:right {:stand warriors-stand
@@ -239,8 +235,19 @@
:anim knight-a-stand
:anim-start 0
:talk knight-a-stand
:stand knight-a-stand)
:stand knight-a-stand
:label "Knights"
:cursor :talk
:talk-color (color 1.0 0.2 0.3 1.0)
:script (actions/get-script entities
(do-warrior-dialogue entities))
:scripts (constantly (actions/get-script entities
(actions/walk-to entities :ego [150 45] :face :left)
(actions/do-dialogue entities :warriors
"We are warriors. We coveteth not earthly possessions."))))
:ladder-guard (actions/start-animation screen (assoc (animation->texture screen ladder-guard-stand) :x 180 :y 70 :baseline 170
:cursor :talk
:label "On-duty knight"
:stand ladder-guard-stand
:talk ladder-guard-talk
:talk-color (color 0.2 0.6 1.0 1.0)
@@ -252,12 +259,14 @@
"Do not durst telleth a soul about that ladder!"
"No thank you, young sire."))))
:stand)
:ladder (assoc (utils/get-texture "inside-cafeteria/ladder.png") :x 205 :y 70 :baseline 170
:ladder (assoc (utils/atlas->texture atlas "ladder") :x 205 :y 70 :baseline 170
:cursor :hand
:label "Ladder"
:script (actions/get-script entities
(actions/talk entities :ladder-guard "Do not toucheth, young sire.")))}
:collision "inside-cafeteria/collision.png"
:fight (make-fight-entity)
:hands-fight (assoc (animation->texture screen hands-fight-win)
:fight (make-fight-entity global-atlas)
:hands-fight (assoc (utils/atlas->texture atlas "fight-new-assets/fight" 0)
:origin-x 128
:origin-y 96
:x 150

View File

@@ -16,6 +16,7 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn brian [screen entities]
(when (and (not (get-in entities [:fg-actions :script-running?]))
(not (get-in entities [:bg-actions :script-running?]))
@@ -360,32 +361,31 @@
(do (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")
nil)))
(defn make [screen]
(let [sign (utils/make-anim-seq "inside-castle/sign" [44 20] 0.3 (flatten [(repeat 20 0) 1 0 2 0 1 0 2 0 1 0 2 0 1]))
game-player-talk-sheet (texture! (utils/get-texture "inside-castle/game-player-talk.png") :split 40 44)
(defn make [screen atlas global-atlas]
(let [sign (utils/make-anim-seq atlas "sign" [44 20] 0.3 (flatten [(repeat 20 0) 1 0 2 0 1 0 2 0 1 0 2 0 1]))
game-player-talk-sheet (texture! (utils/atlas->texture atlas "game-player-talk") :split 40 44)
game-player-talk-up (animation 0.15 (for [i [0 2 0 2 0 2 0 3 0 2 0 1 0 0 0 0 2 0 2 0 3 0 1 0 1 0 0 1 0 2 0 3 0]]
(aget game-player-talk-sheet 0 i)))
game-player-stand-up (animation 0.15 (for [i [0 0 0 0 0 0 0 0 0 0 0 1]]
(aget game-player-talk-sheet 0 i)))
game-player-stand-down (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.1 (flatten (repeat 4 [0 1 1 2 0 2 2 1 0 2 2 2 2 2 1 1 ])))
game-player-talk-down (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.2 [2 3 2 2 3 2 3 2])
game-player-pause-from-work (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.15 [2 3 4 5 6 7])
game-player-get-to-work (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.15 (reverse [2 3 4 5 6 7]))
game-player-stand-down (utils/make-anim atlas "brian-working" [40 44] 0.1 (flatten (repeat 4 [0 1 1 2 0 2 2 1 0 2 2 2 2 2 1 1 ])))
game-player-talk-down (utils/make-anim atlas "brian-working" [40 44] 0.2 [2 3 2 2 3 2 3 2])
game-player-pause-from-work (utils/make-anim atlas "brian-working" [40 44] 0.15 [2 3 4 5 6 7])
game-player-get-to-work (utils/make-anim atlas "brian-working" [40 44] 0.15 (reverse [2 3 4 5 6 7]))
game-player-flex (animation 0.075 (for [i [0 0 4 4 5 5 5 5 5 5 5 6 7 8 7 9 7 8 7 9 7 8 7 9 7 8 7 9 7 8 7 9 7 8 7 9 7 8 7 9 7 8 7 9 7 8 7 9 7 8 7 9 7 8 7 6 5 5 5 5 5 5 5 5 5 5 4 4 0 0 0 0]]
(aget game-player-talk-sheet 0 i)))
trophy (utils/make-anim "inside-castle/trophy.png" [16 16] 0.1 (flatten [(repeat 50 0) 1 2 3 3 3 3 2 1]))
pull-sword-anim (utils/make-anim "inside-castle/pull-sword.png" [95 190] 0.10 (flatten [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 3 2 3 2 3 3 2 3 2 2 3 3 2 3 2 3 2 3 2 3 2 3 2 2 3 3 3 2 3 2 3 3 2 3 2 3 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ]))
monocle (utils/make-anim "inside-castle/monocle.png" [19 19] 0.05 (flatten [(repeat 70 0) 1 2 3 3 3 2 1]))
door (utils/make-anim "inside-castle/door.png" [21 49] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3]))
trophy (utils/make-anim atlas "trophy" [16 16] 0.1 (flatten [(repeat 50 0) 1 2 3 3 3 3 2 1]))
pull-sword-anim (utils/make-anim atlas "pull-sword" [95 190] 0.10 (flatten [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 3 2 3 2 3 3 2 3 2 2 3 3 2 3 2 3 2 3 2 3 2 3 2 2 3 3 3 2 3 2 3 3 2 3 2 3 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ]))
monocle (utils/make-anim atlas "monocle" [19 19] 0.05 (flatten [(repeat 70 0) 1 2 3 3 3 2 1]))
door (utils/make-anim atlas "door" [21 49] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3]))
]
(rooms/make :music {:day :town-1 :night :night :sunrise :night}
:name "Inside castle"
(rooms/make :name "Inside castle"
:timers {:brian [10.0 7.0 brian]}
:interactions
{:right-door {:box [286 140 306 160]
:cursor :right
:script (actions/get-script entities
:only-script (actions/get-script entities
(actions/walk-to entities :ego [284 145] :skip-type :end)
(actions/walk-straight-to entities :ego [295 145])
(if (outside-castle/should-block? entities)
@@ -397,7 +397,7 @@
(actions/walk-straight-to entities :ego [82 180])
(actions/walk-to entities :ego [129 148] :skip-type :end))))}
:up-door {:box [50 150 70 170]
:script (actions/get-script entities
:only-script (actions/get-script entities
(actions/walk-to entities :ego [65 155] :skip-type :end)
(if (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "It's locked.")
@@ -406,7 +406,7 @@
:cursor :up}
:antique-door {:box [154 90 189 150]
:cursor :up
:script (actions/get-script entities
:only-script (actions/get-script entities
(actions/walk-to entities :ego [182 90] :face :left :skip-type :end)
(actions/play-animation entities :ego :reach)
(if (= :night (get-in @entities [:state :time]))
@@ -424,6 +424,8 @@
:shopkeep "Oh, you're not him."
:shopkeep "Welcome to Ye Olde Antique Shop.")))))}
:sword {:box [15 93 49 125]
:label "Pedestal"
:cursor :hand
:script (actions/get-script entities
(if (actions/has-item? entities :sword)
(actions/talk entities :ego "I already have the Sword of Blergh!")
@@ -436,43 +438,51 @@
(pull-sword entities)
(try-to-pull-sword entities missing-items obtained-items))))))}
:sign {:box [125 140 165 155]
:label "Sign"
:cursor :look
:script (actions/get-script entities
(actions/talk entities :ego "Ye Ol' Antique Shoppe."))}
:background-houses {:box [84 145 126 180]
:script (actions/get-script entities
:only-script (actions/get-script entities
(actions/walk-to entities :ego [81 148] :face :right :stop? false :skip-type :end)
(actions/walk-straight-to entities :ego [92 150] :face :right)
(actions/transition-background entities :outside-jail [159 -20])
(actions/walk-straight-to entities :ego [159 20]))
:cursor :right}
:mid-house {:box [217 125 250 180]
:cursor :look
:label "Billy's house"
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's Billy Billigan's house."
:ego "He's probably still angry from when I put his dog in the dryer."))}
:frankie-house {:box [251 140 266 160]
:cursor :look
:label "Frankie's house"
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's Frankie Rockfist's house."
:ego "The last time I saw him, he socked me one, right in the kisser."))}
:georgia-house {:box [271 150 286 170]
:cursor :look
:label "Georgia's house"
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's Georgia McGorgeous' house."
:ego "One day, when I'm a knight, she'll say...")
(actions/georgia-say entities "Kiss me, brave Sir Tick!")
#_(actions/in-love entities))}}
:layers {:day [(assoc (utils/get-texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "inside-castle/way-back-tree.png") :x 0 :y 0 :baseline 97)
(assoc (utils/get-texture "inside-castle/roof.png") :x (- 320 57) :y 0 :baseline 240 :parallax 1.5)
(assoc (utils/get-texture "inside-castle/bookstack.png") :x 244 :y 67 :baseline 190 :origin-x 0 :origin-y 0)]
:night [(assoc (utils/get-texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "inside-castle/way-back-tree.png") :x 0 :y 0 :baseline 97)
(assoc (utils/get-texture "inside-castle/roof.png") :x (- 320 57) :y 0 :baseline 240 :parallax 1.5)]
:sunrise [(assoc (utils/get-texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "inside-castle/way-back-tree.png") :x 0 :y 0 :baseline 97)
(assoc (utils/get-texture "inside-castle/roof.png") :x (- 320 57) :y 0 :baseline 240 :parallax 1.5)]}
:blackout (assoc (utils/get-texture "black.png")
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "way-back-tree") :x 0 :y 0 :baseline 97)
(assoc (utils/atlas->texture atlas "roof") :x (- 320 57) :y 0 :baseline 238 :parallax 1.5)
(assoc (utils/atlas->texture atlas "bookstack") :x 244 :y 67 :baseline 190 :origin-x 0 :origin-y 0)]
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "way-back-tree") :x 0 :y 0 :baseline 97)
(assoc (utils/atlas->texture atlas "roof") :x (- 320 57) :y 0 :baseline 238 :parallax 1.5)]
:sunrise [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "way-back-tree") :x 0 :y 0 :baseline 97)
(assoc (utils/atlas->texture atlas "roof") :x (- 320 57) :y 0 :baseline 238 :parallax 1.5)]}
:blackout (assoc (utils/atlas->texture global-atlas "black")
:x -10 :y -10
:width 340
:height 260 :opacity 0.8
@@ -508,31 +518,33 @@
(particle-effect! magic :allow-completion)
entities)
entities))}]
:entities {:bird-1 (utils/make-bird screen (as-> [[185 235]
:entities {:bird-1 (utils/make-bird screen global-atlas (as-> [[185 235]
[220 225] [210 230] [250 235]] p
(concat p (reverse p))))
:sign (assoc (animation->texture screen sign )
:anim sign
:anim-start 0
:x 125 :y 138 :baseline 239)
:bird-2 (utils/make-bird screen (as-> [[220 225] [195 235] [210 230] [250 225]] p
:x 125 :y 138 :baseline 237)
:bird-2 (utils/make-bird screen global-atlas (as-> [[220 225] [195 235] [210 230] [250 225]] p
(concat p (reverse p))))
:outside-particles (common/make-outside-particles)
:door (assoc (animation->texture screen door)
:door (assoc (animation->texture (assoc screen :total-time 0) door)
:x 160 :y 97 :baseline 99
:open door
:door-sound (utils/load-sound "door.ogg")
:anim-sound-frames {door {1 [:door-sound 0.1]}}
)
:sword (assoc (utils/get-texture "inside-castle/sword.png")
:sword (assoc (utils/atlas->texture atlas "sword")
:x 22
:y 110
:baseline 95)
:walkie-talkie (assoc (utils/get-texture "inside-castle/walkie-talkie.png")
:walkie-talkie (assoc (utils/atlas->texture atlas "walkie-talkie")
:label "Walkie-talkie"
:cursor :talk
:x 257
:y 135
:baseline 0
:baseline 1
:night-profile :sprite
:script (actions/get-script entities
(actions/talk entities :ego "Let's see if this thing works.")
@@ -543,6 +555,8 @@
:trophy (assoc (animation->texture screen trophy)
:x 230 :y 69 :baseline 191
:label "Trophy"
:cursor :hand
:anim trophy
:anim-start 0
:script (actions/get-script entities
@@ -556,12 +570,16 @@
(brian-get-to-work entities))
(actions/do-dialogue entities :ego "Can't you give me your trophy of wisdom?"
:game-player "If you want my trophy, you'll have to help me with my riddles."))))
:books (assoc (utils/get-texture "inside-castle/books.png")
:books (assoc (utils/atlas->texture atlas "books")
:label "Books"
:cursor :hand
:x 230 :y 30 :baseline 191
:script (actions/get-script entities
(walk-to-player entities)
(actions/talk entities :game-player "Don't touch my books!")))
:game-player (assoc (utils/get-texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191
:game-player (assoc (utils/atlas->texture atlas "gameplayer") :x 266 :y 49 :baseline 191
:label "Brian O'Brainy"
:cursor :talk
:talk-color (color 1.0 0.3 0.4 1.0)
:script (actions/get-script entities (do-game-player-dialogue entities))
:writing-sound (utils/load-sound "inside-castle/writing.ogg")
@@ -651,6 +669,8 @@
game-player-flex {1 [:flex-sound 0.5]}}
:flex game-player-flex)}
:monocle (rooms/make-entity :monocle (assoc (animation->texture screen monocle)
:label "A reflective thing"
:cursor :hand
:x 209 :y 160 :baseline 240
:origin-x 9
:anim monocle

View File

@@ -11,36 +11,38 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn open-safe [entities]
(actions/play-animation entities :ego :start-squat :stop? false)
(Thread/sleep 500)
(screen! safe/safe-screen :show-screen
:success (actions/get-script entities
(Thread/sleep 500)
(actions/play-animation entities :ego :end-squat)
{ :success (actions/get-script entities
(Thread/sleep 500)
(actions/play-animation entities :ego :end-squat)
(if (actions/has-item? entities :recipe)
(do
(actions/talk entities :ego "I already took everything interesting from there."))
(do
(actions/talk entities :ego "Yes! That worked.")
(actions/talk entities :ego "Let's see here...")
(actions/play-animation entities :ego :squat)
(actions/talk entities :ego "No, that's a recipe to turn someone into a professional dancer...")
(actions/play-animation entities :ego :squat)
(actions/talk entities :ego "Here's a recipe to make everything taste like cotton candy. I'll just put that back.")
(actions/play-animation entities :ego :squat)
(actions/give entities :recipe)
(actions/talk entities :ego "Aha! Here it is! I found a recipe for a strength potion!")
(actions/talk entities :ego "Looks like there's something else in here too...")
(actions/play-animation entities :ego :squat)
(actions/give entities :mandrake)
(actions/talk entities :ego "Weird. It's some kind of root."))))
:failure (actions/get-script entities
(Thread/sleep 500)
(actions/play-animation entities :ego :end-squat)
(actions/talk entities :ego "I don't think that worked...")))
(if (actions/has-item? entities :recipe)
(do
(actions/talk entities :ego "I already took everything interesting from there."))
(do
(actions/talk entities :ego "Yes! That worked.")
(actions/talk entities :ego "Let's see here...")
(actions/play-animation entities :ego :squat)
(actions/talk entities :ego "No, that's a recipe to turn someone into a professional dancer...")
(actions/play-animation entities :ego :squat)
(actions/talk entities :ego "Here's a recipe to make everything taste like cotton candy. I'll just put that back.")
(actions/play-animation entities :ego :squat)
(actions/give entities :recipe)
(actions/talk entities :ego "Aha! Here it is! I found a recipe for a strength potion!")
(actions/talk entities :ego "Looks like there's something else in here too...")
(actions/play-animation entities :ego :squat)
(actions/give entities :mandrake)
(actions/talk entities :ego "Weird. It's some kind of root."))))
:failure (actions/get-script entities
(Thread/sleep 500)
(actions/play-animation entities :ego :end-squat)
(actions/talk entities :ego "I don't think that worked..."))})
(actions/update-state entities #(assoc % :active? false)))
(defn do-wizard-dialogue [entities]
@@ -131,22 +133,23 @@
"Nevermind."
{:run #(actions/do-dialogue entities :ego %)}]}))
(defn make [screen]
(let [
safe-lock (utils/make-anim "inside-house/safe-lock.png" [11 8] 0.1 (flatten [(repeat 20 0) 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 (range 3 20) 20 20 20 20 21 21 21 21 21 20 20 21 21 21 21 21 20 20 20 ]))
candle (utils/make-anim "inside-house/candle.png" [34 32] 0.2 [1 0 1 2])
candle-aura (utils/make-anim "inside-house/candle-aura.png" [27 27] 0.2 [0 1 2 3 2 1] )
experiment-left (utils/flip (utils/make-anim-seq "wizard/experiment" [45 55] 0.075 [0 0 0 0 0 0 0 0 0 0 1 1 2 2 2 2 3 3 3 4 4 5 5 6 6 6 6 6 6 7 8 9 9 10 10 11 11 12 12 12 12 12 12 12 12 12 12 12 13 13 14 14 14 14 14 15 15 16 16 17 17 18 18 18 18 19 20 21 21 21 21 21 21 22 23 22 23 22 23 22 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24 25 26 27 37 38 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 29 29 28 28 28 28 29 29 28 28 28 28 28 28 28 28 30 30 30 30 31 32 33 31 31 31 31 31 31 31 31 34 35 36 36 36 36 36 36 36 36 36] ))]
(rooms/make :music :inside-fangald
(defn make [screen atlas global-atlas]
(let [safe-lock (utils/make-anim atlas "safe-lock" [11 8] 0.1 (flatten [(repeat 20 0) 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 (range 3 20) 20 20 20 20 21 21 21 21 21 20 20 21 21 21 21 21 20 20 20 ]))
candle (utils/make-anim atlas "candle" [34 32] 0.2 [1 0 1 2])
candle-aura (utils/make-anim atlas "candle-aura" [27 27] 0.2 [0 1 2 3 2 1] )
experiment-left (utils/flip (utils/make-anim-seq global-atlas "wizard/experiment" [45 55] 0.075 [0 0 0 0 0 0 0 0 0 0 1 1 2 2 2 2 3 3 3 4 4 5 5 6 6 6 6 6 6 7 8 9 9 10 10 11 11 12 12 12 12 12 12 12 12 12 12 12 13 13 14 14 14 14 14 15 15 16 16 17 17 18 18 18 18 19 20 21 21 21 21 21 21 22 23 22 23 22 23 22 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24 25 26 27 37 38 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 29 29 28 28 28 28 29 29 28 28 28 28 28 28 28 28 30 30 30 30 31 32 33 31 31 31 31 31 31 31 31 34 35 36 36 36 36 36 36 36 36 36] ))]
(rooms/make
:name "Inside house"
:interactions {:down-dir {:box [151 0 320 40]
:script (actions/get-script entities
:only-script (actions/get-script entities
(actions/update-state entities #(assoc % :wizard-left? false))
(actions/walk-to entities :ego [237 1] :stop? false :skip-type :end)
(actions/walk-straight-to entities :ego [245 -60])
(actions/transition-background entities :outside-house [257 90] :face :left))
:cursor :down}
:safe {:box [34 70 70 115]
:label "MagiSafe 2000"
:cursor :hand
:script (actions/get-script entities
(actions/walk-to entities :ego [59 65])
(if (get-in @entities [:room :entities :wizard])
@@ -159,51 +162,58 @@
(actions/talk entities :ego "How did that tune go again?")
(actions/play-safe entities))))}}
:knight {:box [71 70 102 190]
:cursor :look
:label "Armor"
:script (actions/get-script entities
(actions/talk entities :ego "Maybe when I am an older knight, Gandarf will give me his armor!"))}
:shelves {:box [215 100 320 220]
:cursor :look
:label "Shelves"
:script (actions/get-script entities
(actions/talk entities :ego "His shelves are full of books and strange ingredients."))}
:window {:box [119 120 203 190]
:label "Window"
:cursor :look
:script (actions/get-script entities
(actions/talk entities :ego "It's a really big window!"))}}
:layers [(assoc (utils/get-texture "inside-house/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "inside-house/desk.png") :x 0 :y 0 :baseline 200)
(assoc (utils/get-texture "inside-house/sillhoute.png") :x 0 :y 0 :baseline 240 :parallax 2.0)
(assoc (utils/get-texture "inside-house/glow.png") :x 0 :y 0 :baseline 199 :additive? true)]
:layers [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "desk") :x 0 :y 0 :baseline 200)
(assoc (utils/atlas->texture atlas "sillhoute") :x 0 :y 0 :baseline 240 :parallax 2.0)
(assoc (utils/atlas->texture atlas "glow") :x 0 :y 0 :baseline 199 :additive? true)]
:entities {
:wizard (common/make-wizard screen {:x 228 :y 60 :baseline 160 :scale-x 1.75 :scale-y 1.75 :origin-x 0 :origin-y 0
:script (actions/get-script entities (do-wizard-dialogue entities))
:scripts #(condp = %
:kiss (actions/get-script entities
(actions/do-dialogue entities
:wizard "Good job, boy! You saved a damsel in distress."
:wizard "You have proven yourself worthy in courage."))
:medal (actions/get-script entities
(actions/do-dialogue entities
:wizard "So you beat Captain McHulk at arm wrestling? "
:wizard "You must have been working out!"))
:trophy (actions/get-script entities
(actions/do-dialogue entities
:wizard "My, my, you have proven your worth in wisdom!"
:wizard "One day, you'll be as wise as I am!"))
:recipe (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen possessions."))
:frog-legs (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen possessions."))
:mandrake (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen possessions."))
:flask-1 (actions/get-script entities
(actions/do-dialogue entities
:wizard "You can keep the flask."))
:tune (actions/get-script entities
(actions/talk entities :ego "I think he already has it memorized."))
(actions/get-script entities
:wizard (common/make-wizard screen global-atlas
{:x 228 :y 60 :baseline 160 :scale-x 1.75 :scale-y 1.75 :origin-x 0 :origin-y 0
:script (actions/get-script entities (do-wizard-dialogue entities))
:scripts #(condp = %
:kiss (actions/get-script entities
(actions/do-dialogue entities
:wizard "Good job, boy! You saved a damsel in distress."
:wizard "You have proven yourself worthy in courage."))
:medal (actions/get-script entities
(actions/do-dialogue entities
:wizard "No thank you.")))})
:wizard "So you beat Captain McHulk at arm wrestling? "
:wizard "You must have been working out!"))
:trophy (actions/get-script entities
(actions/do-dialogue entities
:wizard "My, my, you have proven your worth in wisdom!"
:wizard "One day, you'll be as wise as I am!"))
:recipe (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen possessions."))
:frog-legs (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen possessions."))
:mandrake (actions/get-script entities
(actions/do-dialogue entities
:ego "I probably shouldn't show him that I have his stolen possessions."))
:flask-1 (actions/get-script entities
(actions/do-dialogue entities
:wizard "You can keep the flask."))
:tune (actions/get-script entities
(actions/talk entities :ego "I think he already has it memorized."))
(actions/get-script entities
(actions/do-dialogue entities
:wizard "No thank you.")))})
:safe-lock (actions/start-animation screen (assoc (animation->texture screen safe-lock) :x 50 :y 92 :baseline 145
:stand safe-lock)
:stand)
@@ -213,6 +223,8 @@
:baseline 200
:anim candle
:anim-start 0
:label "Candle"
:cursor :look
:script (actions/get-script entities (actions/do-dialogue entities :ego "It's just a candle.")))
:candle-aura (assoc (animation->texture screen candle-aura) :x 172 :y 97 :baseline 239 :additive? true :origin-x 13 :opacity 0.5 :anim candle-aura :anim-start 0)
:candle-smoke (doto (assoc (particle-effect "particles/candle") :x 172 :y 112
@@ -221,16 +233,20 @@
:magic-frog-particle (doto (assoc (particle-effect "particles/magic-frog") :x 230 :y 0
:baseline 241)
(particle-effect! :set-position 237 0))
:flask (assoc (utils/get-texture "inside-house/flask.png")
:flask (assoc (utils/atlas->texture atlas "flask")
:x 265 :y 80 :baseline 240
:label "Flask"
:cursor :hand
:script (actions/get-script entities
(actions/remove-entity entities :flask)
(actions/give entities :flask-1)
(when (get-in @entities [:room :entities :wizard])
(actions/do-dialogue entities :ego "Hey, you think I could have this flask?"
:wizard "Sure."))))
:frog-legs (assoc (utils/get-texture "inside-house/frog-legs.png")
:frog-legs (assoc (utils/atlas->texture atlas "frog-legs")
:x 180 :y 77 :baseline 240
:label "Frog legs"
:cursor :hand
:script (actions/get-script entities
(if (get-in @entities [:room :entities :wizard])
(actions/do-dialogue entities :wizard "Hey, I need those frog legs for one of my spells!")

View File

@@ -14,6 +14,7 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn remove-lock [entities]
(-> entities
@@ -121,6 +122,7 @@
:warden "Be a good chap and let me rest.")
(actions/play-animation entities :warden :fall-asleep :stop? false)
(actions/begin-animation entities :warden :sleep)
(actions/update-state entities (fn [s] (assoc s :warden-sleeping? true))))}]}))
(defn get-key [ entities]
@@ -215,8 +217,8 @@
(defn make [screen]
(let [warden-sheet (texture! (utils/get-texture "inside-jail/warden.png") :split 43 58)
(defn make [screen atlas global-atlas]
(let [warden-sheet (texture! (utils/atlas->texture atlas "warden") :split 43 58)
warden-talk (animation 0.2 (for [i [1 0 1 0 1 0 1 0 0 0 2 0]]
(aget warden-sheet 0 i)))
warden-stand (animation 0.1 (for [i (flatten [(repeat 30 0) 2 (repeat 20 0) 2])]
@@ -225,23 +227,26 @@
(aget warden-sheet 0 i)))
warden-sleep (animation 0.25 (for [i (flatten [ 3 4 3 4 3 4 3 4 3 4 5 5 2 2 2 2 2 2])]
(aget warden-sheet 0 i)))
candle (utils/make-anim "inside-jail/candle.png" [20 25] 0.1 (range 4))
candle-aura (utils/make-anim "inside-house/candle-aura.png" [27 27] 0.2 [0 1 2 3 2 1])
crowbar (utils/make-anim "inside-jail/crowbar.png" [16 33] 0.15 (flatten [(repeat 120 0) [1 2 3 3 2 1]]))]
(rooms/make :music :inside-antique
:name "In jail"
candle (utils/make-anim atlas "candle" [20 25] 0.1 (range 4))
candle-aura (utils/make-anim atlas "candle-aura" [27 27] 0.2 [0 1 2 3 2 1])
crowbar (utils/make-anim atlas "crowbar" [16 33] 0.15 (flatten [(repeat 120 0) [1 2 3 3 2 1]]))]
(rooms/make :name "In jail"
:sounds {
:squeek (utils/load-sound "inside-jail/squeak.ogg")
:crowbar-sound (utils/load-sound "ego/crowbar.ogg")
}
:interactions {
:lock {:box [172 102 190 124]
:label "Lock"
:cursor :hand
:script (actions/get-script entities
(actions/walk-to entities :ego [174 80] :face :right)
(actions/play-animation entities :ego :reach)
(actions/talk entities :ego "There's no helping it. It's locked."))
:scripts {:key (actions/get-script entities (open-lock entities))}}
:window {:box [98 110 118 140]
:label "Window"
:cursor :look
:script (actions/get-script entities
(actions/walk-to entities :ego [102 88] :face :right)
(actions/do-dialogue entities
@@ -269,6 +274,7 @@
(get-in @entities [:room :entities :ego :drop-sound])
0.2)
(actions/update-state entities #(assoc % :dropped-ball? true))
(actions/remove-item entities :ball-n-chain)
(actions/do-dialogue entities :ego "Geronimo!!")
(actions/play-sound entities
"inside-jail/guard-crash.ogg"
@@ -285,7 +291,7 @@
(Thread/sleep 300)
(actions/play-animation entities :warden :fall-asleep :stop? false)
(actions/begin-animation entities :warden :sleep)
(actions/remove-item entities :ball-n-chain)
(actions/talk entities :ego "Phew! That was close!"))
(actions/do-dialogue entities :ego "I don't know what to do with that.")))
:sword (actions/get-script entities (actions/talk entities :ego "I wouldn't want to accidentally break the Sword of Blergh."))
@@ -317,6 +323,8 @@
:ego "The door locks without a key."
:ego "If I get caught, I won't be able to get out."))}}
:hay {:box [130 86 177 102]
:label "Hay"
:cursor :hand
:script (actions/get-script entities
(search-hay entities))
:scripts {:default (actions/get-script entities
@@ -326,6 +334,8 @@
(actions/do-dialogue entities :ego "I'm trying to escape."
:ego "Not help the next bloke who gets trapped here."))}}
:chest {:box [194 62 228 99]
:label "Chest"
:cursor :hand
:script (actions/get-script entities (touch-chest entities))
:scripts {:key (actions/get-script entities
(if (get-in @entities [:state :opened-bars?])
@@ -337,13 +347,13 @@
(actions/talk entities :ego "Not while I'm in this cell.")))}}
:door {:box [257 62 301 152]
:cursor :down
:script (actions/get-script entities (leave entities))}
:only-script (actions/get-script entities (leave entities))}
}
:layers [(assoc (utils/get-texture "inside-jail/background.png") :x 0 :y 0 :baseline 0 :night-profile :none)
(assoc (utils/get-texture "inside-jail/bars.png") :x 0 :y 0 :baseline 165 :night-profile :none)
(assoc (utils/get-texture "inside-jail/glow.png") :x 0 :y 0 :baseline 240 :additive? true :opacity 0.35 :night-profile :none)
(assoc (utils/get-texture "inside-jail/fg.png") :x 0 :y 5 :baseline 241 :parallax 1.5 :night-profile :none)]
:layers [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0 :night-profile :none)
(assoc (utils/atlas->texture atlas "bars") :x 0 :y 0 :baseline 165 :night-profile :none)
(assoc (utils/atlas->texture atlas "glow") :x 0 :y 0 :baseline 240 :additive? true :opacity 0.35 :night-profile :none)
(assoc (utils/atlas->texture atlas "fg") :x 0 :y 5 :baseline 241 :parallax 1.5 :night-profile :none)]
:hotspots [{:box [121 40 258 44]
:fn (fn [screen entities]
@@ -363,7 +373,7 @@
(common/go-to-jail entities)) entities)
entities)
entities)))}]
:entities {:warden (assoc (utils/get-texture "inside-jail/warden.png" )
:entities {:warden (assoc (utils/atlas->texture atlas "warden" )
:x 40 :y 60 :baseline 166
:stand warden-stand
:talk warden-talk
@@ -382,6 +392,8 @@
18 [:blink 0.15]}
warden-sleep {0 [:inhale 0.1]
10 [:exhale 0.1]}}
:label "Warden"
:cursor :talk
:script (actions/get-script entities
(cond
(actions/has-item? entities :key) (actions/talk entities :ego "Shh! It's best not to wake him now.")
@@ -390,6 +402,7 @@
(actions/do-dialogue entities
:ego "Yoo-hoo! Mr. Warden?"
:ego "I guess he's really fast asleep!")
(actions/update-entities entities (fn [e] (assoc-in e [:room :entities :warden :cursor] :hand)))
(actions/update-state entities #(assoc % :warden-fast-asleep? true)))
:else (do (actions/walk-to entities :ego [103 82])
@@ -399,21 +412,23 @@
:ego "I can't kill him just for doing his job."))
:rope (actions/get-script entities (tie-up-warden entities "I'll tie him up."))
:ball-n-chain (actions/get-script entities (tie-up-warden entities "I'll lock him up."))})
:chest-top (assoc (utils/get-texture "inside-jail/chest-top.png")
:chest-top (assoc (utils/atlas->texture atlas "chest-top")
:x 193 :y (- 240 165) :baseline 166
:origin-x 0 :origin-y 0
:night-profile :none
:open (animation 0.8 [(utils/get-texture "inside-jail/chest-top-open.png")])
:close (animation 0.8 [(utils/get-texture "inside-jail/chest-top.png")]))
:ball-n-chain (assoc (utils/get-texture "inside-jail/ball-n-chain.png")
:open (animation 0.8 [(utils/atlas->texture atlas "chest-top-open")])
:close (animation 0.8 [(utils/atlas->texture atlas "chest-top")]))
:ball-n-chain (assoc (utils/atlas->texture atlas "ball-n-chain")
:x 80 :y 80 :baseline 160
:night-profile :none
:label "Ball-n-chain"
:cursor :hand
:script (actions/get-script entities
(actions/walk-to entities :ego [103 83] :face :left)
(actions/play-animation entities :ego :squat)
(actions/remove-entity entities :ball-n-chain)
(actions/give entities :ball-n-chain)))
:moveable-bars (assoc (utils/get-texture "inside-jail/moveable-bars.png")
:moveable-bars (assoc (utils/atlas->texture atlas "moveable-bars")
:night-profile :none
:x 132 :y 77 :baseline 163)
:candle (assoc (animation->texture screen candle)
@@ -423,6 +438,8 @@
:night-profile :none)
:candle-aura (assoc (animation->texture screen candle-aura) :x 215 :y 130 :baseline 2
:additive? true :origin-x 13 :origin-y 13 :opacity 0.5 :anim candle-aura :anim-start 0 :night-profile :none
:label "Candle"
:cursor :look
:script (actions/get-script entities (actions/talk entities :ego "Just a candle."))
:scripts {:default (actions/get-script entities (actions/talk entities :ego "I might catch the place on fire."))})
:candle-smoke (doto (assoc (particle-effect "particles/candle") :x 215 :y 130
@@ -434,6 +451,8 @@
:x 300 :y 60 :baseline 175
:night-profile :none
:label "Crowbar"
:cursor :hand
:script (actions/get-script entities
(if (get-in @entities [:state :opened-bars?])
(do (actions/walk-to entities :ego [295 55] :face :right)
@@ -442,7 +461,7 @@
(actions/give entities :crowbar)
(actions/talk entities :ego "It's a crowbar."))
(actions/talk entities :ego "I can't reach it."))))
:closed-window (assoc (utils/get-texture "inside-jail/window.png")
:closed-window (assoc (utils/atlas->texture atlas "window")
:night-profile :none
:x 99 :y 111 :baseline 128)
:guard { :object nil :width 100 :height 100 :x 70 :y 55 :talk-color (color 0.2 0.6 1.0 1.0)}}
@@ -459,8 +478,10 @@
(if (actions/has-obtained? entities :crowbar)
(update-in entities [:room :entities] #(dissoc % :crowbar))
entities)
(if (get-in entities [:state :warden-sleeping?])
(update-in entities [:room :entities :warden] #(actions/start-animation % :sleep))
(if (get-in entities [:state :warden-fast-asleep?])
(-> entities
(update-in [:room :entities :warden] #(actions/start-animation % :sleep))
(update-in [:room :entities :warden] assoc :cursor :hand))
entities)
(if (get-in entities [:state :opened-bars?])
(update-in (remove-lock entities)

View File

@@ -8,6 +8,7 @@
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn bust-chest [entities]
(if (get-in @entities [:state :broke-lock?])
@@ -54,21 +55,24 @@
(defn make [screen]
(let [candle-flame (utils/make-anim "inside-stash/candle.png" [4 4] 0.1 (range 4))
candle-aura (utils/make-anim "inside-house/candle-aura.png" [27 27] 0.2 [0 1 2 3 2 1] )
(defn make [screen atlas global-atlas]
(let [[screen atlas] (utils/acquire-atlas screen "packed/inside-stash.atlas")
candle-flame (utils/make-anim atlas "candle" [4 4] 0.1 (range 4))
candle-aura (utils/make-anim atlas "candle-aura" [27 27] 0.2 [0 1 2 3 2 1] )
]
(rooms/make :music {:day :secret-hideout :night :secret-hideout}
(rooms/make
:name "Inside stash"
:interactions
{:left-dir {:box [91 60 125 140]
:script (actions/get-script
:only-script (actions/get-script
entities
(actions/walk-straight-to entities :ego [118 96])
(actions/transition-background entities :outside-jail [200 97])
(actions/walk-straight-to entities :ego [167 100]))
:cursor :left}
:candle {:box [160 130 170 140]
:label "Candle"
:cursor :look
:script (actions/get-script
entities
(actions/talk entities :ego "Just a candle."))
@@ -85,14 +89,16 @@
:default (actions/get-script entities
(actions/talk entities :ego "Momma always told me not to play with fire."))}}
:chest {:box [151 107 180 124]
:label "Chest"
:cursor :hand
:script (actions/get-script entities (explore-chest entities))
:scripts {:sword (actions/get-script entities (actions/talk entities :ego "There's not enough room to swing my sword here."))
:crowbar (actions/get-script entities
(bust-chest entities))
:key (actions/get-script entities
(unlock-chest entities))}}}
:layers [(assoc (utils/get-texture "inside-stash/background.png") :x 0 :y 0 :baseline 0 :night-profile :none)]
:entities {:lid (assoc (utils/get-texture "inside-stash/lid.png")
:layers [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0 :night-profile :none)]
:entities {:lid (assoc (utils/atlas->texture atlas "lid")
:x 156 :y 116 :baseline 125 :night-profile :none)
:candle-flame (assoc (animation->texture screen candle-flame)
:x 165 :y 135 :baseline 1

View File

@@ -12,6 +12,7 @@
[play-clj.math :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn flies-vol [entities]
(utils/proximity-volume entities [201 175] :scale 0.20))
@@ -262,10 +263,16 @@
:frankie "And some gold..."
:frankie "And what's this?")
(actions/play-animation entities :frankie :reach)
(actions/remove-item entities :slingshot)
(actions/remove-item entities :medal)
(actions/remove-item entities :trophy)
(actions/do-dialogue entities
:frankie "The Slinger's Shot?"
:ego "No, not the Slinger's Shot!"
:frankie "Looks like we hit the jackpot tonight, boys!")
(actions/remove-item entities :flask-1-strength)
(frankie-comment-on-item entities)
(actions/update-state entities #(assoc % :bubba-gone? true))
(actions/do-dialogue entities
@@ -278,10 +285,6 @@
:frankie "Before we decide to take all of your stuff."
:ego "But I need that slingshot!"
:frankie "Too bad. Move along.")
(actions/remove-item entities :flask-1-strength)
(actions/remove-item entities :medal)
(actions/remove-item entities :trophy)
(actions/remove-item entities :slingshot)
(actions/walk-to entities :ego [181 79])
(actions/do-dialogue entities
@@ -324,25 +327,24 @@
(actions/talk entities :ego "Eww! He slobbered on my hand.")
(actions/give entities :slobber))
(defn make [screen]
(let [peddler-sheet (texture! (utils/get-texture "outside-castle/peddler-talk.png" ) :split 18 36)
(defn make [screen atlas global-atlas]
(let [peddler-sheet (texture! (utils/atlas->texture atlas "peddler-talk" ) :split 18 36)
peddler-talk (animation 0.18 (for [i (flatten [2 3 2 3 2 3 6 1 0 1 0 1 0 1 0 1 2 3 2 3 2 3 6 4 5 4 5 4 5 4 5])]
(aget peddler-sheet 0 i)))
peddler-stand (animation 0.2 (for [i (flatten [(repeat 8 0) 6 (repeat 15 0) 6 (repeat 5 0) 4 5 4 5 4 5 (repeat 10 0)] )]
(aget peddler-sheet 0 i)))
balloon-sheet (texture! (utils/get-texture "outside-castle/balloons.png") :split 20 36)
balloon-sheet (texture! (utils/atlas->texture atlas "balloons") :split 20 36)
balloon-stand (animation 0.25 (for [i [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 0 1 2 1 0 1 2 1 0 1 2 1 0 1 2]]
(aget balloon-sheet 0 i)))
steer-sheet (texture! (utils/get-texture "outside-castle/steer.png") :split 50 35)
steer-sheet (texture! (utils/atlas->texture atlas "steer") :split 50 35)
steer-stand (animation 0.2 (for [i [0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 2 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 3 3 3 3 3 0 0 0 0]]
(aget steer-sheet 0 i)))
flies-stand (utils/make-anim "outside-castle/flies.png" [15 15] 0.075 (flatten (repeat 2 [0 1 2 1])))]
(rooms/make :music {:day :town-2 :night :night :sunrise :night}
:name "Outside castle"
flies-stand (utils/make-anim atlas "flies" [21 21] 0.075 (flatten (repeat 2 [0 1 2 1])))]
(rooms/make :name "Outside castle"
:interactions
{:right-dir {:box [280 40 320 140]
:script (actions/get-script
:only-script (actions/get-script
entities
(actions/walk-to entities :ego [310 80] :stop? false :skip-type :end)
(actions/walk-straight-to entities :ego [340 80])
@@ -350,17 +352,23 @@
(actions/walk-straight-to entities :ego [30 80]))
:cursor :right}
:door {:box [66 180 85 195]
:script (actions/get-script
:only-script (actions/get-script
entities
(go-through-gate entities))
:cursor :left}
:castle {:box [0 181 100 240]
:cursor :look
:label "Castle"
:script (actions/get-script entities
(actions/do-dialogue entities :ego "That's the town of Remington in the distance."))}
:wares {:box [69 75 97 110]
:cursor :look
:label "Wares"
:script (actions/get-script entities
(actions/talk entities :ego "That peddler has all kinds of strange trinkets."))}
:garden {:box [103 170 178 200]
:label "Garden"
:cursor :hand
:script (actions/get-script
entities
(if (actions/has-obtained? entities :carrot)
@@ -373,29 +381,31 @@
(actions/give entities :carrot))))}}
:flies-sound {:sound (utils/load-sound "outside-castle/flies2.ogg")
:id nil}
:layers {:day [(assoc (utils/get-texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "outside-castle/blanket.png") :x 60 :y (- 240 173) :baseline 1)
(assoc (utils/get-texture "outside-castle/brush-bl.png") :origin-x 25 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 25 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/get-texture "outside-castle/brush-br.png") :origin-x 88 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 315 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/get-texture "outside-castle/walk-behind.png") :x 0 :y 0 :baseline 69)]
:night [(assoc (utils/get-texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "blanket") :x 60 :y (- 240 173) :baseline 1)
(assoc (utils/atlas->texture atlas "brush-bl") :origin-x 25 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 25 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/atlas->texture atlas "brush-br") :origin-x 88 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 315 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/atlas->texture atlas "walk-behind") :x 0 :y 0 :baseline 69)]
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "outside-castle/brush-bl.png") :origin-x 25 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 25 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/get-texture "outside-castle/brush-br.png") :origin-x 88 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 315 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/get-texture "outside-castle/walk-behind.png") :x 0 :y 0 :baseline 69)]
:sunrise [(assoc (utils/get-texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "brush-bl") :origin-x 25 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 25 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/atlas->texture atlas "brush-br") :origin-x 88 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 315 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/atlas->texture atlas "walk-behind") :x 0 :y 0 :baseline 69)]
:sunrise [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "outside-castle/brush-bl.png") :origin-x 25 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 25 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/get-texture "outside-castle/brush-br.png") :origin-x 88 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 315 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/get-texture "outside-castle/walk-behind.png") :x 0 :y 0 :baseline 69)]}
(assoc (utils/atlas->texture atlas "brush-bl") :origin-x 25 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 25 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/atlas->texture atlas "brush-br") :origin-x 88 :origin-y 20 :scale-x 1.0 :scale-y 1.0 :x 315 :y 0 :baseline 240 :parallax 1.2)
(assoc (utils/atlas->texture atlas "walk-behind") :x 0 :y 0 :baseline 69)]}
:entities {:peddler (actions/start-animation screen
(assoc (utils/get-texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil
(assoc (utils/atlas->texture atlas "peddler") :x 110 :y 90 :baseline 150 :anim nil
:anim-sound-frames {peddler-stand {8 [:blink 0.3 0.8]
24 [:blink 0.3 0.8]
30 [:scratch 0.15]}
peddler-talk {23 [:scratch 0.15]
6 [:blink 0.3 0.8]
22 [:blink 0.3 0.8]}}
:cursor :talk
:label "Peddler"
:scratch (utils/load-sound "outside-castle/scratch.ogg")
:talk peddler-talk :stand peddler-stand
:talk-color (color 1.0 0.9 0.4 1.0)
@@ -418,7 +428,9 @@
:peddler "No, I have no use for it."))))
:stand)
:steer (actions/start-animation screen (assoc (animation->texture screen steer-stand) :x 203 :y 155 :baseline 80
:steer (actions/start-animation screen (assoc (animation->texture screen steer-stand) :x 203 :y 151 :baseline 80
:label "Angus, the buff bull"
:cursor :hand
:stand steer-stand
:night-profile :sprite
:moo (utils/load-sound "outside-castle/moo.ogg")
@@ -453,12 +465,14 @@
(assoc (animation->texture screen balloon-stand)
:x 75
:y 100
:cursor :look
:label "Balloons"
:baseline 140
:stand balloon-stand
:script (actions/get-script entities
(actions/talk entities :ego "Those look like the choicest of balloons.")))
:stand)
:bird (utils/make-bird screen (as-> [[82 235] [134 215] [185 235] [165 238]
:bird (utils/make-bird screen global-atlas (as-> [[82 235] [134 215] [185 235] [165 238]
[220 225] [210 230] [250 235]] p
(concat p (reverse p))))
@@ -466,7 +480,9 @@
:outside-particles (common/make-outside-particles)
:flies (assoc (animation->texture screen flies-stand)
:x 201
:y 175
:y 178
:label "Flies"
:cursor :look
:anim flies-stand
:anim-start 0
:baseline 240
@@ -487,7 +503,9 @@
:script (actions/get-script entities
(actions/talk entities :ego "Those flies seem to be attracted to Angus' stench."))
)}
:note (rooms/make-entity :note (assoc (utils/get-texture "outside-castle/note.png")
:note (rooms/make-entity :note (assoc (utils/atlas->texture atlas "note")
:label "Bingo card"
:cursor :hand
:x 198 :y 66 :baseline 174
:script (actions/get-script entities
(actions/walk-to entities :ego [210 79] :face :left)

View File

@@ -16,6 +16,7 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn dawn-fade [entities]
@@ -121,7 +122,7 @@
(actions/play-animation entities :ego :reach-stop :stop? true)
(actions/remove-item entities :slingshot)
(actions/remove-item entities :slingshot :quiet? true )
(actions/give entities :magic-slingshot)
(actions/do-dialogue entities :ego "It worked!")
@@ -194,9 +195,7 @@
(particle-effect! (get-in @entities [:room :entities :magic-frog-particle]) :reset)
(particle-effect! (get-in @entities [:room :entities :magic-frog-particle]) :start)
(Thread/sleep 1500)
(actions/transition-background entities :outside-house [257 90] :face :left)
(dotimes [_ 160]
(particle-effect! (get-in @entities [:rooms :inside-house :entities :magic-frog-particle]) :update 0.2)))
(actions/transition-background entities :outside-house [257 90] :face :left))
(defn do-prophecy [entities]
{:run #(do (actions/respond entities %
@@ -550,10 +549,10 @@
(/ (:delta-time screen)
(/ 1.0 60.0)))
speed (if (< delta-x 0) (- speed) speed)
moved-x (if (< (Math/abs delta-x) speed)
moved-x (if (< (Math/abs (int delta-x)) speed)
target-x
(* speed (/ delta-x delta-x) ))]
(if (< (Math/abs delta-x) speed)
(if (< (Math/abs (int delta-x)) speed)
(actions/start-animation screen
(dissoc e :target-x)
:stand)
@@ -604,32 +603,32 @@
(actions/talk entities :ego "That's a big cauldron!"))))
(defn make [screen]
(let [sheep-stand-sheet (texture! (utils/get-texture "outsidehouse/sheep-anim.png") :split 33 21)
sheep-walk-sheet (texture! (utils/get-texture "outsidehouse/sheep-walk.png") :split 33 21)
lamb-walk-sheet (texture! (utils/get-texture "outsidehouse/lamb-walk.png") :split 27 28)
(defn make [screen atlas global-atlas]
(let [sheep-stand-sheet (texture! (utils/atlas->texture atlas "sheep-anim") :split 33 21)
sheep-walk-sheet (texture! (utils/atlas->texture atlas "sheep-walk") :split 33 21)
lamb-walk-sheet (texture! (utils/atlas->texture atlas "lamb-walk") :split 27 28)
sheep-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 11) (repeat 15 12)])]
(aget sheep-stand-sheet 0 i)))
sheep-1 (utils/make-anim "outsidehouse/sheep-1.png" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
sheep-2 (utils/make-anim "outsidehouse/sheep-2.png" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
sheep-3 (utils/make-anim "outsidehouse/sheep-3.png" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
door (utils/make-anim "outsidehouse/door.png" [24 58] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3]))
sheep-1 (utils/make-anim atlas "sheep-1" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
sheep-2 (utils/make-anim atlas "sheep-2" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
sheep-3 (utils/make-anim atlas "sheep-3" [33 21] 0.15 (flatten [(repeat 10 0) 1 2 3 4 5 6 7 4 5 6 7 8 2 1 (repeat 25 0) (repeat 15 9)]))
door (utils/make-anim atlas "door" [24 58] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3]))
door-closed (utils/make-anim atlas "door" [24 58] 0.15 [0])
sheep-walk (animation 0.05 (for [i (range 6)]
(aget sheep-walk-sheet 0 i)))
butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1])
cauldron (utils/make-anim "outsidehouse/cauldron.png" [50 38] 0.15 (range 4))
charcoal (utils/make-anim-seq "outsidehouse/charcoal" [18 18] 0.25 (range 4))
butterfly-stand (utils/make-anim atlas "butterfly" [7 7] 0.1 [0 1])
cauldron (utils/make-anim atlas "cauldron" [50 38] 0.15 (range 4))
charcoal (utils/make-anim-seq atlas "charcoal" [24 18] 0.25 (range 4))
scaler (utils/scaler-fn-with-baseline 110 0.10 1.00)
lamb-stand (aget lamb-walk-sheet 0 0)
lamb-walk (animation 0.075 (for [i (range 4)]
(aget lamb-walk-sheet 0 i)))]
(rooms/make :music {:day :town-2 :night :night}
:name "Outside house"
(rooms/make :name "Outside house"
:update-fn jump-around
:cauldron-sound {:object nil :sound (utils/load-sound "outsidehouse/cauldron.ogg")}
:interactions
{:door {:box [250 100 281 160]
:script
:only-script
(actions/get-script
entities
(actions/walk-to entities :ego [257 90] :face :right :skip-type :end)
@@ -646,7 +645,7 @@
:else
(do (actions/play-animation entities :door :open)
(actions/transition-background entities :inside-house [237 0] :between (fn [s e]
(if (= 1 (rand-int 2))
(if (= 1 (rand-int 5))
(assoc-in e [:room :entities :experiment] (get-in e [:room :experiment]))
e)))
(when (get-in @entities [:room :entities :experiment])
@@ -660,43 +659,45 @@
:cursor :right}
:right-dir {:box [220 141 320 204]
:script (actions/get-script
:only-script (actions/get-script
entities
(actions/walk-to entities :ego [244 150] :skip-type :end)
(actions/transition-background entities :behind-house [122 140])
(actions/walk-to entities :ego [172 122]))
:cursor :right}
:up-dir {:box [105 180 203 240]
:script (actions/get-script
:only-script (actions/get-script
entities
(actions/walk-to entities :ego [137 204] :skip-type :end)
(actions/transition-background entities :cat-tree [223 -51])
(actions/walk-straight-to entities :ego [200 10]))
:cursor :up}
:left-dir {:box [0 40 40 140]
:script (actions/get-script
:only-script (actions/get-script
entities
(walk-to-castle entities))
:cursor :left}}
:layers {:day [(assoc (utils/get-texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122)
(assoc (utils/get-texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93)
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
(assoc (utils/atlas->texture atlas "fence") :x 0 :y 0 :baseline 93)
(assoc (utils/get-texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44)
(assoc (utils/get-texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
(assoc (utils/get-texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]
:night [(assoc (utils/get-texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122)
(assoc (utils/get-texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93)
(assoc (utils/atlas->texture atlas "background-trees") :x 0 :y 0 :baseline 44)
(assoc (utils/atlas->texture atlas "fg1") :x 0 :y 0 :baseline 1000 :parallax 1.5)
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "house") :x 0 :y 0 :baseline 122)
(assoc (utils/atlas->texture atlas "fence") :x 0 :y 0 :baseline 93)
(assoc (utils/get-texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44)
(assoc (utils/get-texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
(assoc (utils/get-texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]}
(assoc (utils/atlas->texture atlas "background-trees") :x 0 :y 0 :baseline 44)
(assoc (utils/atlas->texture atlas "fg1") :x 0 :y 0 :baseline 1000 :parallax 1.5)
(assoc (utils/atlas->texture atlas "fg2") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]}
:entities {:sheep (actions/start-animation screen
(assoc (animation->texture screen sheep-stand) :x 38 :y 160 :baseline 80
[:stand 1] sheep-1
[:stand 2] sheep-2
[:stand 3] sheep-3
:label "Sheep"
:cursor :hand
:origin-y 3
:origin-x 6
:scale-x (scaler [38 160])
@@ -751,7 +752,7 @@
(if (is-sheep-close? @entities)
(do (walk-to-sheep entities)
(actions/play-animation entities :ego :milk)
(actions/remove-item entities :flask-1)
(actions/remove-item entities :flask-1 :quiet? true)
(actions/give entities :flask-1-with-milk)
(actions/talk entities :ego "Sheep's milk.")
)
@@ -785,30 +786,32 @@
:outside-particles (common/make-outside-particles)
:magic (assoc (doto (particle-effect "particles/magic") )
:magic (assoc (particle-effect "particles/magic")
:x 153
:y 105
:baseline 238)
:door (assoc (animation->texture screen door)
:x 252 :y 88 :baseline 122
:door (assoc (animation->texture screen door-closed)
:x 252 :y 88 :baseline 123
:open door
:door-sound (utils/load-sound "door.ogg")
:anim-sound-frames {door {1 [:door-sound 0.1]}}
)
:lamb (assoc (utils/get-texture "outsidehouse/lamb.png")
:x 10 :y 163 :baseline 77
:right {:stand (animation 0.1 [lamb-stand])
:walk lamb-walk}
:left {:stand (utils/flip (animation 0.1 [lamb-stand]))
:walk (utils/flip lamb-walk)}
:scale-x (scaler [10 163])
:scale-y (scaler [10 163])
:script (actions/get-script entities
(actions/talk entities :ego "Aww, it's a newborn lamb!"))
:scripts {:carrot (actions/get-script entities (actions/talk entities :ego "I think it's still nursing."))
:grass (actions/get-script entities (actions/talk entities :ego "I think it's still nursing."))
:sword (actions/get-script entities (actions/talk entities :ego "I prefer to let the butcher make lamb chops."))})
:lamb (assoc (utils/atlas->texture atlas "lamb")
:cursor :look
:label "Baby lamb"
:x 10 :y 163 :baseline 77
:right {:stand (animation 0.1 [lamb-stand])
:walk lamb-walk}
:left {:stand (utils/flip (animation 0.1 [lamb-stand]))
:walk (utils/flip lamb-walk)}
:scale-x (scaler [10 163])
:scale-y (scaler [10 163])
:script (actions/get-script entities
(actions/talk entities :ego "Aww, it's a newborn lamb!"))
:scripts {:carrot (actions/get-script entities (actions/talk entities :ego "I think it's still nursing."))
:grass (actions/get-script entities (actions/talk entities :ego "I think it's still nursing."))
:sword (actions/get-script entities (actions/talk entities :ego "I prefer to let the butcher make lamb chops."))})
:butterfly (assoc (animation->texture screen butterfly-stand)
:x 161
:y 218
@@ -820,10 +823,12 @@
(let [speed 0.009
pos-f (- (* (:total-time screen) speed) (int (* (:total-time screen) speed)))
v (vector-2 0 0)
a (catmull-rom-spline! (:path entity) :value-at v pos-f)]
a (catmull-rom-spline! ^CatmullRomSpline (:path entity) :value-at v pos-f)]
(assoc entity :x (vector-2! v :x) :y (vector-2! v :y)))))}
:cauldron (rooms/make-entity :cauldron (assoc (animation->texture screen cauldron)
:cursor :look
:x 139 :y 73 :baseline 167
:label "Magical cauldron"
:anim cauldron
:anim-start 0
:night-profile :none
@@ -832,10 +837,12 @@
:scripts put-something-in-cauldron))
:charcoal (rooms/make-entity :charcoal
(assoc (animation->texture screen charcoal)
:cursor :hand
:label "Charcoal"
:anim charcoal
:anim-start 0
:night-profile :none
:x 125 :y 73 :baseline 167
:x 119 :y 73 :baseline 167
:script (actions/get-script entities
(actions/walk-to entities :ego [120 73])
(actions/play-animation entities :ego :start-squat-2 :stop? false)
@@ -846,14 +853,16 @@
(actions/talk entities :ego "It's a small, sharp piece of charcoal.")
)
))
:wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2
:wizard (rooms/make-entity :wizard (common/make-wizard screen global-atlas {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2
:script (actions/get-script entities (talk-to-gandarf-outside entities))
:scripts {:default (actions/get-script entities (actions/talk entities :wizard "No time for that!"))
:sword (actions/get-script entities (actions/do-dialogue entities
:wizard "The Sword of Blergh!"
:wizard "Good job, Tick."))}}))
:note (rooms/make-entity :note (assoc (utils/get-texture "outsidehouse/note.png")
:note (rooms/make-entity :note (assoc (utils/atlas->texture atlas "note")
:x 277 :y 74 :baseline 160
:label "Paper airplane"
:cursor :hand
:night-profile :none
:script (actions/get-script entities
(actions/walk-to entities :ego [280 80] :face :right)

View File

@@ -9,6 +9,7 @@
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn add-spear-if-necessary [entities]
(if (and (not (actions/has-obtained? entities :spear))
@@ -93,19 +94,19 @@
(actions/walk-straight-to entities :ego [142 96])
(actions/talk entities :ego "This must be Frankie Rockfist's secret stash!")))
(defn make [screen]
(let [guard-sheet (texture! (utils/get-texture "inside-cafeteria/ladder-guard.png") :split 37 87)
(defn make [screen atlas global-atlas]
(let [guard-sheet (texture! (utils/atlas->texture atlas "guard") :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))
open-stash (utils/make-anim "outside-jail/open-stash.png" [58 41] 0.075 (reverse (range 5)))
close-stash (utils/make-anim "outside-jail/open-stash.png" [58 41] 0.075 (range 5))
candle-flame (utils/make-anim "outside-jail/candle.png" [20 25] 0.075 (range 4))
candle-aura (utils/make-anim "outside-jail/candle-aura2.png" [135 135] 0.3 [0 1 2 1] )]
(rooms/make :music {:day :town-1 :night :night}
guard-sleep (utils/make-anim atlas "guard-sleep" [43 67] 0.1 (range 4))
open-stash (utils/make-anim atlas "open-stash" [58 41] 0.075 (reverse (range 5)))
close-stash (utils/make-anim atlas "open-stash" [58 41] 0.075 (range 5))
candle-flame (utils/make-anim atlas "candle" [20 25] 0.075 (range 4))
candle-aura (utils/make-anim atlas "candle-aura2" [135 135] 0.3 [0 1 2 1] )]
(rooms/make
:name "Fountain"
:interactions {:down-dir {:box [30 0 227 40]
:script (actions/get-script entities
:only-script (actions/get-script entities
(actions/walk-to entities :ego [159 5] :skip-type :end :stop? false)
(actions/walk-straight-to entities :ego [159 -20])
(actions/transition-background entities :inside-castle [92 150])
@@ -113,24 +114,34 @@
(actions/walk-to entities :ego [159 74] :skip-type :end))
:cursor :down}
:door {:box [22 42 46 124]
:script (actions/get-script entities
:cursor :left
:only-script (actions/get-script entities
(if (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "I do NOT want to go back in there!")
(do (actions/walk-to entities :ego [50 46])
(actions/talk entities :warden "NO VISITORS!"))))}
:window {:box [62 175 80 212]
:label "Window"
:cursor :look
:script (actions/get-script entities
(if (= :night (get-in @entities [:state :time]))
(actions/do-dialogue entities :ego "Boy am I glad to be out of there!"
:ego "They didn't even give me my one telephone call!")
(actions/talk entities :ego "I wonder if anyone is imprisoned up there?")))}
:sign {:box [5 173 61 199]
:label "Sign"
:cursor :look
:script (actions/get-script entities
(actions/talk entities :ego "J.A.I.L. Jail. Can't you read?"))}
:my-house {:box [89 128 118 179]
:label "House"
:cursor :look
:script (actions/get-script entities
(actions/talk entities :ego "That's my house. I'd rather play outside."))}
:sherrif-house {:box [138 143 160 168]
:label "Sherriff's house"
:cursor :look
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's the Sheriff's house."
@@ -139,6 +150,8 @@
:ego "Or windows."
:ego "What's the big deal?"))}
:mchulk-house {:box [223 137 282 172]
:label "Captain McHulk's house"
:cursor :look
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's Captain McHulk's house!"
@@ -146,6 +159,8 @@
:ego "If only I could be as strong as he is one day."
))}
:stump {:box [205 68 251 100]
:label "Stump"
:cursor :hand
:script (actions/get-script entities
(actions/walk-to entities :ego [170 71] :face :right)
(actions/walk-straight-to entities :ego [188 71] :face :right)
@@ -178,6 +193,8 @@
:frog-legs (actions/get-script entities (actions/talk entities :ego "They're already chopped up!"))
:broken-clock (actions/get-script entities (actions/talk entities :ego "It's already split in half!"))}}
:lever {:box [3 72 20 90]
:label "Candle"
:cursor :hand
:script (actions/get-script entities
(interact-with-lever entities))
:scripts {:rope (actions/get-script entities
@@ -202,24 +219,27 @@
(actions/talk entities :ego "Why would I want to burn that?")
(actions/talk entities :ego "The candle's not lit right now.")))}}
:end-of-rope {:box [177 101 185 108]
:label "Rope"
:cursor :hand
:script (actions/get-script entities (try-to-go-in-stash entities))}
:fountain {:box [150 126 193 170]
:label "Fountain"
:cursor :look
:script (actions/get-script entities
(actions/walk-to entities :ego [151 119] :face :right)
(actions/do-dialogue entities :ego "Some would say this is life-giving nectar."
:ego "... Me?"
:ego "I'd just as soon say it's nasty public fountain water.")
(actions/play-animation entities :ego :get-sick))
:ego "I'd just as soon say it's nasty public fountain water."))
: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/remove-item entities :flask-2 :quiet? true)
(actions/give entities :flask-water)
(actions/talk entities :ego "Filled up with water, just as Gandarf wanted."))}}}
:layers {:day [(assoc (utils/get-texture "outside-jail/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "outside-jail/fountain.png") :x 0 :y 0 :baseline 114)]
:night [(assoc (utils/get-texture "outside-jail/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "outside-jail/fountain.png") :x 0 :y 0 :baseline 114)]}
:layers {:day [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "fountain") :x 0 :y 0 :baseline 114)]
:night [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)
(assoc (utils/atlas->texture atlas "fountain") :x 0 :y 0 :baseline 114)]}
:entities {:warden {:object nil
:x 36
:y 86
@@ -241,8 +261,8 @@
:x 172
:y 140
:baseline 114)
:axe (assoc (utils/get-texture "outside-jail/axe.png") :x 213 :y 63 :baseline 176 :night-profile :sprite)
:bent-bar-window (assoc (utils/get-texture "outside-jail/bent-bar-window.png")
:axe (assoc (utils/atlas->texture atlas "axe") :x 213 :y 63 :baseline 176 :night-profile :sprite)
:bent-bar-window (assoc (utils/atlas->texture atlas "bent-bar-window")
:x 69 :y (- 240 63) :baseline 2)
:outside-particles (common/make-outside-particles)}
:fountain-sound {:sound (utils/load-sound "outside-jail/fountain-2.ogg")
@@ -257,23 +277,29 @@
:stand guard-stand
:talk guard-talk
:sleep guard-sleep
:label "Knocked out guard"
:cursor :hand
:script (actions/get-script entities (search-guard entities))
:night-profile :sprite))
:rope (rooms/make-entity :rope (assoc (utils/get-texture "outside-jail/rope.png")
:rope (rooms/make-entity :rope (assoc (utils/atlas->texture atlas "rope")
:x 14 :y 20 :baseline 1 :night-profile :sprite))
:spear (rooms/make-entity :spear (assoc (utils/get-texture "outside-jail/spear.png")
:spear (rooms/make-entity :spear (assoc (utils/atlas->texture atlas "spear")
:night-profile :none
:x 60 :y 65 :baseline 180
:label "Spear"
:cursor :hand
:script (actions/get-script entities (grab-spear entities))))
:alarm-clock (rooms/make-entity :alarm-clock (assoc (utils/get-texture "outside-jail/alarm-clock.png")
:alarm-clock (rooms/make-entity :alarm-clock (assoc (utils/atlas->texture atlas "alarm-clock")
:x 217 :y 83 :baseline 160
:label "Broken clock"
:cursor :hand
:script (actions/get-script entities
(actions/walk-to entities :ego [189 65] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :alarm-clock)
(actions/give entities :alarm-clock))))
:stash (rooms/make-entity :stash (assoc (animation->texture screen open-stash)
:stash (rooms/make-entity :stash (assoc (animation->texture (assoc screen :total-time 0) open-stash)
:x 197 :y 94 :baseline 146
:open open-stash
:close close-stash))
@@ -285,15 +311,30 @@
:apply-state (fn [screen entities]
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
(as-> entities entities
(utils/play-sound! screen entities (get-in entities [:room :fountain-sound :sound])
(utils/sourced-volume-fn :fountain 0.06 [172 120])
(utils/get-sound-pan 172)
:loop)
(if (= :night (get-in entities [:state :time]))
(make-night entities)
(update-in entities [:room :entities] dissoc :candle-aura :candle-flame))
(if (get-in entities [:state :dropped-ball?])
(update-in entities [:room :entities :guard] #(actions/start-animation % :sleep))
(update-in entities [:room :entities] dissoc :bent-bar-window )))))))
(if (get-in entities [:state :knows-about-stash?])
(update-in entities [:room :interactions] (fn [xs]
(for [i xs]
(if (= (:id i)
:lever)
(assoc i :cursor :hand)
i))))
(update-in entities [:room :interactions] (fn [xs]
(for [i xs]
(if (= (:id i)
:lever)
(assoc i :cursor :look)
i)))))
(if (= :night (get-in entities [:state :time]))
(make-night entities)
(update-in entities [:room :entities] dissoc :candle-aura :candle-flame))
(if (get-in entities [:state :dropped-ball?])
(update-in entities [:room :entities :guard] #(actions/start-animation % :sleep))
(update-in entities [:room :entities] dissoc :bent-bar-window )))))))

View File

@@ -15,6 +15,7 @@
[play-clj.utils :refer :all]
[play-clj.math :refer :all]
[play-clj.g2d :refer :all]))
(println "loading " *ns*)
(defn taunt [screen entities]
(when (and (not (get-in entities [:fg-actions :script-running?]))
@@ -80,7 +81,7 @@
(skip-type [this screen entities]
:none)))
(defn swing-at-blergh [entities]
(defn swing-at-blergh [entities atlas]
(let [jump-path (bezier (map #(apply vector-2* %) [[35 45] [110 145] [195 180]]))
swing-path (bezier (map #(apply vector-2* %) [[195 180] [205 45]]))
jump-dist (utils/dist 35 45 205 45)
@@ -94,7 +95,7 @@
(utils/play-sound! screen entities :jump (constantly 0.9))
(-> entities
(assoc-in [:room :entities :cloud] (assoc (utils/get-texture "space/cloud.png")
(assoc-in [:room :entities :cloud] (assoc (utils/atlas->texture atlas "cloud")
:x (- (get-in entities [:room :entities :ego :x]) 10)
:y (get-in entities [:room :entities :ego :y])
:origin-x 7
@@ -182,33 +183,32 @@
(defn grunt-vol [entities]
(* 0.3 (get-in entities [:room :entities :bloodclot :opacity])))
(defn make [screen]
(let [bloodclot-head-talk-anim (utils/make-anim-seq "space/bloodclot-head-talk" [82 75] 0.05 [0 0 1 1 2 2 1 1 0 0 1 1 2 2 1 1 0 0 3 4 4 4 3 0 0 1 1 2 2 1 1 0 0 0 0 5 5 5 6 6 6 7 7 7])
bloodclot-head-stand-anim (utils/make-anim-seq "space/bloodclot-head-talk" [82 75] 0.05 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 3])
bloodclot-head-shoot-anim (utils/make-anim-seq "space/bloodclot-head-talk" [82 75] 0.05 [8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 10 11 10 11 10 11 10 11 10 11 10 11])
bloodclot-head-keep-shoot-anim (utils/make-anim-seq "space/bloodclot-head-talk" [82 75] 0.05 [12 13])
blergh-stand-anim (utils/make-anim "space/bloodclot-stand.png" [106 165] 0.9 [0 1])
bloodclot-explode (utils/make-anim-seq "space/bloodclot-explode" [106 165] 0.075 [0 0 0 0 0 0 0 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 8 8 8 7 7 7 7 8 8 8 8 8 7 7 7 7 8 8 7 7 7 7 8 8 8 7 8 8 8 8 8 8 8 8 9 8 8 8 8 9 9 8 8 8 8 8 8 8 9 9 9 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 10 10 8 9 9 9 9 9 10 10 10 10 9 9 9 9 9 9 9 9 9 9 10 10 10 10 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 13 14 15 16 17 18 19 20 21 22])
bullet (utils/make-anim "space/bullet.png" [24 24] 0.0075 [0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 3 3 3 4 4 5 5 6 5 4 7])
(defn make [screen atlas global-atlas]
(let [bloodclot-head-talk-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [0 0 1 1 2 2 1 1 0 0 1 1 2 2 1 1 0 0 3 4 4 4 3 0 0 1 1 2 2 1 1 0 0 0 0 5 5 5 6 6 6 7 7 7])
bloodclot-head-stand-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 3])
bloodclot-head-shoot-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 8 9 10 11 10 11 10 11 10 11 10 11 10 11])
bloodclot-head-keep-shoot-anim (utils/make-anim-seq atlas "bloodclot-head-talk" [82 75] 0.05 [12 13])
blergh-stand-anim (utils/make-anim atlas "bloodclot-stand" [106 165] 0.9 [0 1])
bloodclot-explode (utils/make-anim-seq atlas "bloodclot-explode" [106 165] 0.075 [0 0 0 0 0 0 0 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 8 8 8 7 7 7 7 8 8 8 8 8 7 7 7 7 8 8 7 7 7 7 8 8 8 7 8 8 8 8 8 8 8 8 9 8 8 8 8 9 9 8 8 8 8 8 8 8 9 9 9 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 10 9 10 10 8 9 9 9 9 9 10 10 10 10 9 9 9 9 9 9 9 9 9 9 10 10 10 10 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 12 13 14 15 16 17 18 19 20 21 22])
bullet (utils/make-anim atlas "bullet" [24 24] 0.0075 [0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 3 3 3 4 4 5 5 6 5 4 7])
effect (particle-effect "particles/appear")
blowup-effect (particle-effect "particles/blowup")
lightning-effect (particle-effect "particles/lightning")
grow-explode (particle-effect "particles/grow-explode")]
(rooms/make :music :fight
:name "Duel"
(rooms/make :name "Duel"
:sounds {:shock (utils/load-sound "space/shock.ogg")
:shock-short (utils/load-sound "space/shock-short.ogg")
:jump (utils/load-sound "space/jump.ogg")
:swing-sword (utils/load-sound "space/swingsword.ogg")}
:interactions
{}
:layers [(assoc (utils/get-texture "space/background.png") :x 0 :y 0 :baseline 0)]
:layers [(assoc (utils/atlas->texture atlas "background") :x 0 :y 0 :baseline 0)]
:timers {:taunt [10.0 8.0 taunt]
:shock [5.0 15.0 shock]}
:entities {:appear (assoc effect
:x 240 :y 50
:baseline 200)
:later (assoc (utils/get-texture "space/later.png")
:later (assoc (utils/atlas->texture atlas "later")
:x 0 :y 0
:baseline 240
:opacity 0.0)
@@ -248,6 +248,8 @@
:explode bloodclot-explode
:label "Bloodclot"
:cursor :talk
:script (actions/get-script entities
(actions/do-dialogue entities
:bloodclot-head "No time to talk."
@@ -271,7 +273,7 @@
(if (actions/has-item? entities :magic-slingshot)
(if (get-in @entities [:state :broke-jewel?])
(do
(swing-at-blergh entities)
(swing-at-blergh entities atlas)
(actions/do-dialogue entities
:bloodclot-head "Ha ha ha! Still a weakling, I see."
:bloodclot-head "But you'll not best me!")
@@ -284,7 +286,7 @@
(actions/update-entity entities :ego (fn [e]
(dissoc e :stand-override :talk-override)))
(actions/update-entity entities :ego #(assoc % :get-script (:original-get-script %)))
(swing-at-blergh entities)
(swing-at-blergh entities atlas)
(actions/do-dialogue entities :bloodclot-head "Ha ha ha! Is that the best you can do?"
:bloodclot-head "Take this!")
@@ -336,7 +338,7 @@
:bullet (assoc (animation->texture screen bullet)
:x 37 :y 85 :baseline 241
:walk bullet)
:broken-jewel (assoc (utils/get-texture "space/broken-jewel.png")
:broken-jewel (assoc (utils/atlas->texture atlas "broken-jewel")
:x 225 :y 170 :baseline 240)
:collision "space/collision.png"
:scale-fn (constantly 1.5)