parallax scrolling used elsewhere.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 18 KiB |
BIN
desktop/resources/behindhouse/fg.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
desktop/resources/behindhouse/fg2.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
desktop/resources/behindhouse/fgleft.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 51 KiB |
BIN
desktop/resources/inside-antique/fg.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 28 KiB |
BIN
desktop/resources/inside-cafeteria/fg.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
BIN
desktop/resources/inside-castle/roof.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 21 KiB |
BIN
desktop/resources/outsidehouse/fg.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
desktop/resources/outsidehouse/fgtest.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
@@ -97,11 +97,11 @@
|
|||||||
0.07)
|
0.07)
|
||||||
current-zoom
|
current-zoom
|
||||||
target-zoom)
|
target-zoom)
|
||||||
target-x (min (- 320 (* 160.0 target-zoom))
|
target-x (min (- 320 (* 160.0 target-zoom ))
|
||||||
(max (* 160.0 target-zoom)
|
(max (* 160.0 target-zoom )
|
||||||
x))
|
x))
|
||||||
target-y (min (- 240 (* 120.0 target-zoom))
|
target-y (min (- 240 (* 120.0 target-zoom ))
|
||||||
(max (* 120.0 target-zoom)
|
(max (* 120.0 target-zoom )
|
||||||
y))]
|
y))]
|
||||||
(if (or (not= target-x (get-in entities [:cam :x]))
|
(if (or (not= target-x (get-in entities [:cam :x]))
|
||||||
(not= target-y (get-in entities [:cam :y]))
|
(not= target-y (get-in entities [:cam :y]))
|
||||||
|
|||||||
@@ -47,7 +47,9 @@
|
|||||||
:ego "It's hard to make out from this angle.")))}}
|
:ego "It's hard to make out from this angle.")))}}
|
||||||
:layers {:day [(assoc (texture "behindhouse/background.png") :x 0 :y 0 :baseline 0)
|
:layers {:day [(assoc (texture "behindhouse/background.png") :x 0 :y 0 :baseline 0)
|
||||||
(assoc (texture "behindhouse/house.png") :x 0 :y 0 :baseline 122)
|
(assoc (texture "behindhouse/house.png") :x 0 :y 0 :baseline 122)
|
||||||
(assoc (texture "behindhouse/brush.png") :x 0 :y 0 :baseline 240)]
|
(assoc (texture "behindhouse/brush.png") :x 0 :y 0 :baseline 240)
|
||||||
|
(assoc (texture "behindhouse/fgleft.png") :x -10 :y 0 :baseline 240 :parallax 1.5)
|
||||||
|
(assoc (texture "behindhouse/fg2.png") :x (- 320 122) :y 0 :baseline 240 :parallax 1.5)]
|
||||||
:night [(assoc (texture "behindhouse/background-dark.png") :x 0 :y 0 :baseline 0)
|
:night [(assoc (texture "behindhouse/background-dark.png") :x 0 :y 0 :baseline 0)
|
||||||
(assoc (texture "behindhouse/house-dark.png") :x 0 :y 0 :baseline 122)
|
(assoc (texture "behindhouse/house-dark.png") :x 0 :y 0 :baseline 122)
|
||||||
(assoc (texture "behindhouse/brush-dark.png") :x 0 :y 0 :baseline 240)]}
|
(assoc (texture "behindhouse/brush-dark.png") :x 0 :y 0 :baseline 240)]}
|
||||||
|
|||||||
@@ -166,7 +166,8 @@
|
|||||||
:ego "It's a tapestry of Rupert the Lion!"
|
:ego "It's a tapestry of Rupert the Lion!"
|
||||||
:ego "He's the town of Remington's mascot."))}
|
:ego "He's the town of Remington's mascot."))}
|
||||||
}
|
}
|
||||||
:layers [(assoc (texture "inside-antique/background.png") :x 0 :y 0 :baseline 0)]
|
:layers [(assoc (texture "inside-antique/background.png") :x 0 :y 0 :baseline 0)
|
||||||
|
(assoc (texture "inside-antique/fg.png") :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
|
:entities {:shopkeep (actions/start-animation screen (assoc (animation->texture screen shopkeep-stand) :x 148 :y 122 :baseline 112
|
||||||
:stand shopkeep-stand
|
:stand shopkeep-stand
|
||||||
:scale-x 1.6
|
:scale-x 1.6
|
||||||
|
|||||||
@@ -164,7 +164,8 @@
|
|||||||
(actions/walk-to entities :ego [126 80]))
|
(actions/walk-to entities :ego [126 80]))
|
||||||
:cursor :right}
|
:cursor :right}
|
||||||
}
|
}
|
||||||
:layers [(assoc (texture "inside-cafeteria/background.png") :x 0 :y 0 :baseline 0)]
|
:layers [(assoc (texture "inside-cafeteria/background.png") :x 0 :y 0 :baseline 0)
|
||||||
|
(assoc (texture "inside-cafeteria/fg.png") :x 10 :y 0 :scale-x 1.1 :scale-y 1.0 :baseline 320 :parallax 1.5)]
|
||||||
:entities {
|
:entities {
|
||||||
:warriors (actions/start-animation screen (assoc (animation->texture screen warriors-stand) :x 8 :y 19 :baseline 180
|
:warriors (actions/start-animation screen (assoc (animation->texture screen warriors-stand) :x 8 :y 19 :baseline 180
|
||||||
|
|
||||||
|
|||||||
@@ -284,7 +284,8 @@
|
|||||||
(actions/do-dialogue entities
|
(actions/do-dialogue entities
|
||||||
:ego "That's Georgia McGorgeous' house."
|
:ego "That's Georgia McGorgeous' house."
|
||||||
:ego "One day, when I'm a knight, I'll ask her to be my girlfriend."))}}
|
:ego "One day, when I'm a knight, I'll ask her to be my girlfriend."))}}
|
||||||
:layers {:day [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)]
|
:layers {:day [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
|
||||||
|
(assoc (texture "inside-castle/roof.png") :x (- 320 57) :y 0 :baseline 240 :parallax 1.5)]
|
||||||
:night [(assoc (texture "inside-castle/background-dark.png") :x 0 :y 0 :baseline 0)]
|
:night [(assoc (texture "inside-castle/background-dark.png") :x 0 :y 0 :baseline 0)]
|
||||||
:sunrise [(assoc (texture "inside-castle/background-sunrise.png") :x 0 :y 0 :baseline 0)]}
|
:sunrise [(assoc (texture "inside-castle/background-sunrise.png") :x 0 :y 0 :baseline 0)]}
|
||||||
:blackout (assoc (texture "black.png")
|
:blackout (assoc (texture "black.png")
|
||||||
|
|||||||
@@ -290,7 +290,8 @@
|
|||||||
(actions/play-animation entities :ego :squat)
|
(actions/play-animation entities :ego :squat)
|
||||||
(actions/talk entities :ego "No one will notice one missing.")
|
(actions/talk entities :ego "No one will notice one missing.")
|
||||||
(actions/give entities :carrot))))}}
|
(actions/give entities :carrot))))}}
|
||||||
:layers {:day [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]
|
:layers {:day [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)
|
||||||
|
]
|
||||||
:night [(assoc (texture "outside-castle/background-dark.png") :x 0 :y 0 :baseline 0)]
|
:night [(assoc (texture "outside-castle/background-dark.png") :x 0 :y 0 :baseline 0)]
|
||||||
:sunrise [(assoc (texture "outside-castle/background-sunrise.png") :x 0 :y 0 :baseline 0)]}
|
:sunrise [(assoc (texture "outside-castle/background-sunrise.png") :x 0 :y 0 :baseline 0)]}
|
||||||
:entities {:peddler (actions/start-animation screen
|
:entities {:peddler (actions/start-animation screen
|
||||||
|
|||||||
@@ -312,7 +312,11 @@
|
|||||||
(assoc (texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122)
|
(assoc (texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122)
|
||||||
(assoc (texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93)
|
(assoc (texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93)
|
||||||
|
|
||||||
(assoc (texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44)]
|
(assoc (texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44)
|
||||||
|
(assoc (texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
|
||||||
|
(assoc (texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)
|
||||||
|
#_(assoc (texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
|
||||||
|
#_(assoc (texture "outsidehouse/fg2.png") :x (- 320 30) :y 0 :baseline 1000 :parallax 1.5)]
|
||||||
:night [(assoc (texture "outsidehouse/background-dark.png") :x 0 :y 0 :baseline 0)
|
:night [(assoc (texture "outsidehouse/background-dark.png") :x 0 :y 0 :baseline 0)
|
||||||
(assoc (texture "outsidehouse/house-dark.png") :x 0 :y 0 :baseline 122)
|
(assoc (texture "outsidehouse/house-dark.png") :x 0 :y 0 :baseline 122)
|
||||||
(assoc (texture "outsidehouse/fence-dark.png") :x 0 :y 0 :baseline 93)
|
(assoc (texture "outsidehouse/fence-dark.png") :x 0 :y 0 :baseline 93)
|
||||||
|
|||||||
@@ -436,8 +436,8 @@
|
|||||||
(update-fn screen entities)
|
(update-fn screen entities)
|
||||||
entities))
|
entities))
|
||||||
|
|
||||||
(defn render-foreground [{:keys [^OrthographicCamera camera ^Stage renderer] :as screen} foreground]
|
(defn render-parallax [{:keys [^OrthographicCamera camera ^Stage renderer] :as screen} {:keys [parallax] :as e }]
|
||||||
#_(println camera)
|
|
||||||
(let [tmp (Vector3.)
|
(let [tmp (Vector3.)
|
||||||
tmp2 (Vector3.)
|
tmp2 (Vector3.)
|
||||||
parallax-view (Matrix4.)
|
parallax-view (Matrix4.)
|
||||||
@@ -445,8 +445,8 @@
|
|||||||
(.update camera)
|
(.update camera)
|
||||||
|
|
||||||
(.set tmp (.position camera))
|
(.set tmp (.position camera))
|
||||||
(set! (.x tmp) (* (.x tmp) 1.5))
|
(set! (.x tmp) (* (.x tmp) parallax))
|
||||||
(set! (.y tmp) (* (.y tmp) 1.5))
|
(set! (.y tmp) (* (.y tmp) parallax))
|
||||||
(.setToLookAt parallax-view tmp (-> tmp2
|
(.setToLookAt parallax-view tmp (-> tmp2
|
||||||
(.set tmp)
|
(.set tmp)
|
||||||
(.add (.direction camera)))
|
(.add (.direction camera)))
|
||||||
@@ -460,9 +460,12 @@
|
|||||||
(.begin batch)
|
(.begin batch)
|
||||||
(.setProjectionMatrix batch parallax-combined)
|
(.setProjectionMatrix batch parallax-combined)
|
||||||
|
|
||||||
(doseq [e (:texes foreground)]
|
(entities/draw! (assoc e :x (+ (/ (:x e) (.zoom camera))
|
||||||
(entities/draw! (assoc e :x (+ (/ (:x e) (.zoom camera)) (- 240 (/ 160 (.zoom camera)) ))
|
(- (* 320 parallax 0.5)
|
||||||
:y (+ (/ (:y e) (.zoom camera)) (- 180 (/ 120 (.zoom camera))))) screen batch))
|
(/ 160 (.zoom camera)) ))
|
||||||
|
:y (+ (/ (:y e) (.zoom camera))
|
||||||
|
(- (* 240 parallax 0.5)
|
||||||
|
(/ 120 (.zoom camera))))) screen batch)
|
||||||
(.end batch))))
|
(.end batch))))
|
||||||
|
|
||||||
|
|
||||||
@@ -493,7 +496,7 @@
|
|||||||
:outside-castle (rooms.outside-castle/make screen)}
|
:outside-castle (rooms.outside-castle/make screen)}
|
||||||
entities {:rooms rooms
|
entities {:rooms rooms
|
||||||
:step-particles (assoc (particle-effect "ego/step") :x 100 :y 100 :baseline 241)
|
:step-particles (assoc (particle-effect "ego/step") :x 100 :y 100 :baseline 241)
|
||||||
:cam {:zoom 0.95
|
:cam {:zoom 0.95
|
||||||
:object nil}
|
:object nil}
|
||||||
:musics {:object nil
|
:musics {:object nil
|
||||||
:inside-antique (utils/make-music "inside-antique.ogg")
|
:inside-antique (utils/make-music "inside-antique.ogg")
|
||||||
@@ -531,9 +534,6 @@
|
|||||||
:last :main
|
:last :main
|
||||||
:override nil
|
:override nil
|
||||||
:last-pos [0 0]}
|
:last-pos [0 0]}
|
||||||
:foreground {:object nil
|
|
||||||
:texes [(assoc (texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000)
|
|
||||||
(assoc (texture "outsidehouse/fg2.png") :x (- 320 59) :y 0 :baseline 1000)]}
|
|
||||||
|
|
||||||
:all-items (assoc items/items :object nil)
|
:all-items (assoc items/items :object nil)
|
||||||
:started? {:value false
|
:started? {:value false
|
||||||
@@ -603,8 +603,12 @@
|
|||||||
(doseq [m (vals (get-in entities [:musics]))]
|
(doseq [m (vals (get-in entities [:musics]))]
|
||||||
(when m
|
(when m
|
||||||
(music! m :set-volume (get-in entities [:volume :value]))))
|
(music! m :set-volume (get-in entities [:volume :value]))))
|
||||||
(render! screen (sort-by :baseline all-entities))
|
(doseq [e (sort-by :baseline all-entities)]
|
||||||
(render-foreground screen (:foreground entities))
|
(if (:parallax e)
|
||||||
|
(render-parallax screen e)
|
||||||
|
(render! screen [e])))
|
||||||
|
|
||||||
|
|
||||||
entities))
|
entities))
|
||||||
|
|
||||||
:on-resize (fn [{:keys [viewport width height]} [entities]]
|
:on-resize (fn [{:keys [viewport width height]} [entities]]
|
||||||
|
|||||||