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