improved intro.
This commit is contained in:
@@ -38,13 +38,14 @@
|
||||
(utils/setup-viewport screen 1280 960)
|
||||
(utils/load-settings!)
|
||||
(let [font (utils/get-font "ego/font.fnt")
|
||||
start-playing (assoc (label "Embark on thy adventure" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 100)
|
||||
start-playing (assoc (label "Embark on thy adventure" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 100 :height 32 :origin-x 0 :origin-y 0)
|
||||
start-playing (center start-playing)
|
||||
quit (assoc (label "Quit thy adventure" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 50)
|
||||
quit (assoc (label "Quit thy adventure" (style :label font (color 0.6 1.0 1.0 1.0))) :x 0 :y 65 :height 32 :origin-x 0 :origin-y 0)
|
||||
quit (center quit)
|
||||
music (utils/make-music "intro.ogg")
|
||||
ui-skin (skin "ui/ui.json")]
|
||||
(label! start-playing :set-alignment Align/center)
|
||||
(label! quit :set-alignment Align/center)
|
||||
|
||||
{:overlay (assoc (texture "title-overlay.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
|
||||
:fade (assoc (texture "black.png")
|
||||
@@ -54,13 +55,13 @@
|
||||
:origin-x 0
|
||||
:origin-y 0)
|
||||
:music-volume-slider (assoc (slider {:min 0 :max 100 :step 1} ui-skin :set-value (:music-volume @utils/settings))
|
||||
:x ( - (/ (game :width) 2)
|
||||
:x ( - (/ 1280 2)
|
||||
150)
|
||||
:width 300
|
||||
:y 200)
|
||||
:sound-volume-slider (assoc (slider {:min 0 :max 100 :step 1 } ui-skin :set-value (:sound-volume @utils/settings))
|
||||
:width 300
|
||||
:x ( - (/ (game :width) 2)
|
||||
:x ( - (/ 1280 2)
|
||||
150)
|
||||
:y 150)
|
||||
|
||||
@@ -93,7 +94,6 @@
|
||||
entities))
|
||||
:on-ui-changed
|
||||
(fn [screen [entities]]
|
||||
(println "HER")
|
||||
(swap! utils/settings
|
||||
assoc
|
||||
:music-volume (slider! (:music-volume-slider entities) :get-value)
|
||||
@@ -102,30 +102,31 @@
|
||||
entities)
|
||||
|
||||
:on-touch-up (fn [screen [entities]]
|
||||
(let [[x y] (utils/unproject screen)]
|
||||
(cond
|
||||
(utils/intersects? (:start-playing entities) [x y])
|
||||
(-> entities
|
||||
(assoc-in [:tweens :fade-out]
|
||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||
:finish (fn [entities]
|
||||
(utils/stop-sound (:music entities))
|
||||
(set-screen! @(resolve 'advent.core/advent) scene/scene scene/hud dialogue/talking-screen dialogue/choice-screen inventory/inventory-screen safe/safe-screen)
|
||||
entities)
|
||||
:ease tween/ease-in-cubic))
|
||||
(assoc-in [:tweens :fade-out-music]
|
||||
(tween/tween :fade-out-music screen [:volume] 1.0 0.0 1.0)))
|
||||
(utils/intersects? (:quit entities) [x y])
|
||||
(-> entities
|
||||
(assoc-in [:tweens :fade-out]
|
||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||
:finish (fn [entities]
|
||||
(System/exit 0)
|
||||
entities)
|
||||
:ease tween/ease-in-cubic)))
|
||||
(when-not (get-in entities [:tweens :fade-out])
|
||||
(let [[x y] (utils/unproject screen)]
|
||||
(cond
|
||||
(utils/intersects? (:start-playing entities) [x y])
|
||||
(-> entities
|
||||
(assoc-in [:tweens :fade-out]
|
||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||
:finish (fn [entities]
|
||||
(utils/stop-sound (:music entities))
|
||||
(set-screen! @(resolve 'advent.core/advent) scene/scene scene/hud dialogue/talking-screen dialogue/choice-screen inventory/inventory-screen safe/safe-screen)
|
||||
entities)
|
||||
:ease tween/ease-in-cubic))
|
||||
(assoc-in [:tweens :fade-out-music]
|
||||
(tween/tween :fade-out-music screen [:volume] 1.0 0.0 1.0)))
|
||||
(utils/intersects? (:quit entities) [x y])
|
||||
(-> entities
|
||||
(assoc-in [:tweens :fade-out]
|
||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||
:finish (fn [entities]
|
||||
(System/exit 0)
|
||||
entities)
|
||||
:ease tween/ease-in-cubic)))
|
||||
|
||||
:else
|
||||
nil)))
|
||||
:else
|
||||
nil))))
|
||||
|
||||
:on-resize (fn [{:keys [viewport width height]} [entities]]
|
||||
(.update viewport width height)
|
||||
|
||||
Reference in New Issue
Block a user