hourglass, for sure, between title and game.
This commit is contained in:
@@ -54,3 +54,5 @@
|
|||||||
+Click on active item, move off, cursor is still active
|
+Click on active item, move off, cursor is still active
|
||||||
|
|
||||||
+ Click on cauldron should tell you what you need to add
|
+ Click on cauldron should tell you what you need to add
|
||||||
|
|
||||||
|
+can walk to top corner in house screen
|
||||||
|
|||||||
@@ -629,15 +629,16 @@ void main()
|
|||||||
entities))
|
entities))
|
||||||
|
|
||||||
(defn update-cursor [screen {{:keys [current override last active was-active]} :cursor :as entities}]
|
(defn update-cursor [screen {{:keys [current override last active was-active]} :cursor :as entities}]
|
||||||
(let [new-current (or override current)]
|
|
||||||
(when-not (and (= new-current
|
(if (= 0.0 (get-in entities [:fade :opacity]))
|
||||||
last)
|
(let [new-current (or override current)]
|
||||||
(= active was-active))
|
(when-not (and (= new-current
|
||||||
(when (= :last :hourglass)
|
last)
|
||||||
(println new-current))
|
(= active was-active))
|
||||||
(let [image-path (if active "cursor_light.png" "cursor.png")]
|
(let [image-path (if active "cursor_light.png" "cursor.png")]
|
||||||
(input! :set-cursor-image (utils/cursor image-path (or (:cursor new-current) new-current)) 0 0)))
|
(input! :set-cursor-image (utils/cursor image-path (or (:cursor new-current) new-current)) 0 0)))
|
||||||
(assoc-in entities [:cursor :last] new-current)))
|
(assoc-in entities [:cursor :last] new-current))
|
||||||
|
entities))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -795,8 +796,7 @@ void main()
|
|||||||
(let [screen (assoc screen :total-time 0)]
|
(let [screen (assoc screen :total-time 0)]
|
||||||
(let [[cam] (utils/setup-viewport screen 320 240)]
|
(let [[cam] (utils/setup-viewport screen 320 240)]
|
||||||
(set! (. cam zoom) 0.95)
|
(set! (. cam zoom) 0.95)
|
||||||
(let [_ (input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0)
|
(let [shader (ShaderProgram. v-shader pix-shader)
|
||||||
shader (ShaderProgram. v-shader pix-shader)
|
|
||||||
_ (update! screen :shader shader)
|
_ (update! screen :shader shader)
|
||||||
rooms {:inside-house (rooms.inside-house/make screen)
|
rooms {:inside-house (rooms.inside-house/make screen)
|
||||||
:inside-stash (rooms.inside-stash/make screen)
|
:inside-stash (rooms.inside-stash/make screen)
|
||||||
@@ -835,6 +835,8 @@ void main()
|
|||||||
:sprite utils/default-night-merge-sprite
|
:sprite utils/default-night-merge-sprite
|
||||||
:none {}}
|
:none {}}
|
||||||
|
|
||||||
|
:closing? {:object nil
|
||||||
|
:value false}
|
||||||
:sounds {:blink (sound "blink-other.ogg")
|
:sounds {:blink (sound "blink-other.ogg")
|
||||||
:object nil}
|
:object nil}
|
||||||
:fade {:object nil
|
:fade {:object nil
|
||||||
@@ -857,8 +859,8 @@ void main()
|
|||||||
:value nil}
|
:value nil}
|
||||||
:cursor {:id "cursor"
|
:cursor {:id "cursor"
|
||||||
:current :main
|
:current :main
|
||||||
:last :main
|
:last nil
|
||||||
:override nil
|
:override :hourglass
|
||||||
:last-pos [0 0]}
|
:last-pos [0 0]}
|
||||||
|
|
||||||
:all-items (assoc items/items :object nil)
|
:all-items (assoc items/items :object nil)
|
||||||
@@ -882,73 +884,83 @@ void main()
|
|||||||
|
|
||||||
:on-render
|
:on-render
|
||||||
(fn [{:keys [camera] :as screen} [entities]]
|
(fn [{:keys [camera] :as screen} [entities]]
|
||||||
(clear!)
|
|
||||||
|
|
||||||
(let [entities (fade-in-first-time-if-necessary screen entities)
|
(if (get-in entities [:closing? :value])
|
||||||
entities (utils/apply-tweens screen entities (:tweens entities))
|
|
||||||
entities (update-cursor screen entities)
|
(let [entities (utils/apply-tweens screen entities (:tweens entities))
|
||||||
entities (update-from-script screen entities)
|
layers (get-layers entities)
|
||||||
entities (update-from-room screen entities)
|
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
|
||||||
entities (update-from-hotspots screen entities)
|
(screen! fade-screen :update-fade :opacity (get-in entities [:fade :opacity]))
|
||||||
entities (assoc-in entities [:room :entities :ego :last-frame] (get-in entities [:room :entities :ego :object]))
|
#_(doseq [e (sort-by :baseline all-entities)]
|
||||||
entities (update-in entities [:room :entities] (fn [entities]
|
|
||||||
(into entities
|
|
||||||
(for [[id entity] entities]
|
|
||||||
(if (:anim entity)
|
|
||||||
[id (animate entity screen)]
|
|
||||||
[id entity])))))
|
|
||||||
entities (update-in entities [:room :entities] (fn [entities]
|
|
||||||
(into entities
|
|
||||||
(for [[id entity] entities]
|
|
||||||
(if (:update-fn entity)
|
|
||||||
[id ((:update-fn entity) screen entities entity)]
|
|
||||||
[id entity])))))
|
|
||||||
|
|
||||||
entities (if (and (not (get-in entities [:cam :paused?]))
|
|
||||||
(nil? (get-in entities [:tweens :cam-x]))
|
|
||||||
(= 1 (rand-int 20)))
|
|
||||||
(if (= (rand-int 2) 1)
|
|
||||||
(actions/pan-to screen entities
|
|
||||||
(get-in entities [:room :entities :ego :x])
|
|
||||||
(get-in entities [:room :entities :ego :y])
|
|
||||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
|
||||||
tween/ease-in-out-quadratic
|
|
||||||
5.0)
|
|
||||||
(actions/pan-to screen entities
|
|
||||||
(+ (get-in entities [:cam :x] 0)
|
|
||||||
(- 10 (rand-int 20)))
|
|
||||||
(+ (get-in entities [:cam :y] 0)
|
|
||||||
(- 10 (rand-int 20)))
|
|
||||||
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
|
||||||
tween/ease-in-out-quadratic
|
|
||||||
5.0))
|
|
||||||
entities)
|
|
||||||
|
|
||||||
|
|
||||||
layers (get-layers entities)
|
|
||||||
|
|
||||||
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
|
|
||||||
(screen! talking-screen :on-update-camera :scene-viewport (:viewport screen) :scene-camera (:camera screen))
|
|
||||||
(screen! fade-screen :update-fade :opacity (get-in entities [:fade :opacity]))
|
|
||||||
(when true #_(not (get-in entities [:cam :paused?]))
|
|
||||||
(set! (. camera zoom) (:zoom (:cam entities)))
|
|
||||||
(set! (.. camera position x) (:x (:cam entities) 160.0))
|
|
||||||
(set! (.. camera position y) (:y (:cam entities) 120.0)))
|
|
||||||
(let [entities (utils/update-override screen entities)]
|
|
||||||
|
|
||||||
|
|
||||||
(when (= (get-in entities [:fade :opacity])
|
|
||||||
0.0)
|
|
||||||
(play-key-sounds entities))
|
|
||||||
(doseq [m (vals (get-in entities [:musics]))]
|
|
||||||
(when m
|
|
||||||
(music! m :set-volume (utils/current-music-volume (get-in entities [:volume :value])))))
|
|
||||||
(doseq [e (sort-by :baseline all-entities)]
|
|
||||||
(if (:parallax e)
|
(if (:parallax e)
|
||||||
(render-parallax screen (get-rendered entities e))
|
(render-parallax screen (get-rendered entities e))
|
||||||
(render! screen [(get-rendered entities e)])))
|
(render! screen [(get-rendered entities e)]))))
|
||||||
|
(let [entities (fade-in-first-time-if-necessary screen entities)
|
||||||
entities)))
|
entities (utils/apply-tweens screen entities (:tweens entities))
|
||||||
|
entities (update-cursor screen entities)
|
||||||
|
entities (update-from-script screen entities)
|
||||||
|
entities (update-from-room screen entities)
|
||||||
|
entities (update-from-hotspots screen entities)
|
||||||
|
entities (assoc-in entities [:room :entities :ego :last-frame] (get-in entities [:room :entities :ego :object]))
|
||||||
|
entities (update-in entities [:room :entities] (fn [entities]
|
||||||
|
(into entities
|
||||||
|
(for [[id entity] entities]
|
||||||
|
(if (:anim entity)
|
||||||
|
[id (animate entity screen)]
|
||||||
|
[id entity])))))
|
||||||
|
entities (update-in entities [:room :entities] (fn [entities]
|
||||||
|
(into entities
|
||||||
|
(for [[id entity] entities]
|
||||||
|
(if (:update-fn entity)
|
||||||
|
[id ((:update-fn entity) screen entities entity)]
|
||||||
|
[id entity])))))
|
||||||
|
|
||||||
|
entities (if (and (not (get-in entities [:cam :paused?]))
|
||||||
|
(nil? (get-in entities [:tweens :cam-x]))
|
||||||
|
(= 1 (rand-int 20)))
|
||||||
|
(if (= (rand-int 2) 1)
|
||||||
|
(actions/pan-to screen entities
|
||||||
|
(get-in entities [:room :entities :ego :x])
|
||||||
|
(get-in entities [:room :entities :ego :y])
|
||||||
|
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||||
|
tween/ease-in-out-quadratic
|
||||||
|
5.0)
|
||||||
|
(actions/pan-to screen entities
|
||||||
|
(+ (get-in entities [:cam :x] 0)
|
||||||
|
(- 10 (rand-int 20)))
|
||||||
|
(+ (get-in entities [:cam :y] 0)
|
||||||
|
(- 10 (rand-int 20)))
|
||||||
|
(constantly (get-in entities [:room :entities :ego :scale-x]))
|
||||||
|
tween/ease-in-out-quadratic
|
||||||
|
5.0))
|
||||||
|
entities)
|
||||||
|
|
||||||
|
|
||||||
|
layers (get-layers entities)
|
||||||
|
|
||||||
|
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
|
||||||
|
(clear!)
|
||||||
|
(screen! talking-screen :on-update-camera :scene-viewport (:viewport screen) :scene-camera (:camera screen))
|
||||||
|
(screen! fade-screen :update-fade :opacity (get-in entities [:fade :opacity]))
|
||||||
|
(when true #_(not (get-in entities [:cam :paused?]))
|
||||||
|
(set! (. camera zoom) (:zoom (:cam entities)))
|
||||||
|
(set! (.. camera position x) (:x (:cam entities) 160.0))
|
||||||
|
(set! (.. camera position y) (:y (:cam entities) 120.0)))
|
||||||
|
(let [entities (utils/update-override screen entities)]
|
||||||
|
|
||||||
|
|
||||||
|
(when (= (get-in entities [:fade :opacity])
|
||||||
|
0.0)
|
||||||
|
(play-key-sounds entities))
|
||||||
|
(doseq [m (vals (get-in entities [:musics]))]
|
||||||
|
(when m
|
||||||
|
(music! m :set-volume (utils/current-music-volume (get-in entities [:volume :value])))))
|
||||||
|
(doseq [e (sort-by :baseline all-entities)]
|
||||||
|
(if (:parallax e)
|
||||||
|
(render-parallax screen (get-rendered entities e))
|
||||||
|
(render! screen [(get-rendered entities e)])))
|
||||||
|
|
||||||
|
entities))))
|
||||||
|
|
||||||
:on-resize (fn [{:keys [viewport width height]} [entities]]
|
:on-resize (fn [{:keys [viewport width height]} [entities]]
|
||||||
(.update viewport width height))
|
(.update viewport width height))
|
||||||
@@ -995,14 +1007,14 @@ void main()
|
|||||||
(click-inventory screen entities))
|
(click-inventory screen entities))
|
||||||
:on-menu (fn [screen [entities]]
|
:on-menu (fn [screen [entities]]
|
||||||
(when-not (get-in entities [:tweens :fade-out])
|
(when-not (get-in entities [:tweens :fade-out])
|
||||||
|
(input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
||||||
(-> entities
|
(-> entities
|
||||||
(assoc-in [:cursor :override] nil)
|
(assoc-in [:closing? :value] true)
|
||||||
(assoc-in [:tweens :fade-out-music]
|
(assoc-in [:tweens :fade-out-music]
|
||||||
(tween/tween :fade-out-music screen [:volume :value] 1.0 0.0 1.0))
|
(tween/tween :fade-out-music screen [:volume :value] 1.0 0.0 1.0))
|
||||||
(assoc-in [:tweens :fade-out]
|
(assoc-in [:tweens :fade-out]
|
||||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||||
:finish #(do (.clear @(resolve 'advent.core/am))
|
:finish #(do (.clear @(resolve 'advent.core/am))
|
||||||
(input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0)
|
|
||||||
(set-screen! @(resolve 'advent.core/advent) @(resolve 'advent.screens.title/title-screen))
|
(set-screen! @(resolve 'advent.core/advent) @(resolve 'advent.screens.title/title-screen))
|
||||||
%))))))
|
%))))))
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@
|
|||||||
(label! start-playing :set-alignment Align/center)
|
(label! start-playing :set-alignment Align/center)
|
||||||
(label! quit :set-alignment Align/center)
|
(label! quit :set-alignment Align/center)
|
||||||
(label! fullscreen :set-alignment Align/center)
|
(label! fullscreen :set-alignment Align/center)
|
||||||
|
(input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
||||||
|
|
||||||
{:background (assoc (texture "title/background.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
|
{:background (assoc (texture "title/background.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
|
||||||
:cloud-background (assoc (texture "title/clouds.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
|
:cloud-background (assoc (texture "title/clouds.png" ) :x 0 :y 0 :scale-x 4 :scale-y 4 :origin-x 0 :origin-y 0)
|
||||||
@@ -148,7 +149,10 @@
|
|||||||
:fullscreen fullscreen
|
:fullscreen fullscreen
|
||||||
:copyright copyright
|
:copyright copyright
|
||||||
:tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0
|
:tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0
|
||||||
:finish #(do (utils/play-sound (:music %)) %)
|
:finish #(do
|
||||||
|
|
||||||
|
(input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0)
|
||||||
|
(utils/play-sound (:music %)) %)
|
||||||
:ease tween/ease-in-quadratic)}}))
|
:ease tween/ease-in-quadratic)}}))
|
||||||
|
|
||||||
:on-render
|
:on-render
|
||||||
@@ -188,24 +192,26 @@
|
|||||||
(let [[x y] (utils/unproject screen)]
|
(let [[x y] (utils/unproject screen)]
|
||||||
(cond
|
(cond
|
||||||
(utils/intersects? (:start-playing entities) [x y])
|
(utils/intersects? (:start-playing entities) [x y])
|
||||||
(-> entities
|
(do (input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
||||||
(assoc-in [:tweens :fade-out]
|
(-> entities
|
||||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
(assoc-in [:tweens :fade-out]
|
||||||
:finish (fn [entities]
|
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||||
(utils/stop-sound (:music entities))
|
:finish (fn [entities]
|
||||||
(set-screen! @(resolve 'advent.core/advent) scene/scene scene/hud dialogue/talking-screen dialogue/choice-screen inventory/inventory-screen safe/safe-screen fade/fade-screen)
|
(utils/stop-sound (:music entities))
|
||||||
entities)
|
(set-screen! @(resolve 'advent.core/advent) scene/scene scene/hud dialogue/talking-screen dialogue/choice-screen inventory/inventory-screen safe/safe-screen fade/fade-screen)
|
||||||
:ease tween/ease-in-cubic))
|
entities)
|
||||||
(assoc-in [:tweens :fade-out-music]
|
:ease tween/ease-in-cubic))
|
||||||
(tween/tween :fade-out-music screen [:volume] 1.0 0.0 1.0)))
|
(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])
|
(utils/intersects? (:quit entities) [x y])
|
||||||
(-> entities
|
(do (input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
|
||||||
(assoc-in [:tweens :fade-out]
|
(-> entities
|
||||||
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
(assoc-in [:tweens :fade-out]
|
||||||
:finish (fn [entities]
|
(tween/tween :fade-out screen [:fade :opacity] 0.0 1.0 1.0
|
||||||
(System/exit 0)
|
:finish (fn [entities]
|
||||||
entities)
|
(System/exit 0)
|
||||||
:ease tween/ease-in-cubic)))
|
entities)
|
||||||
|
:ease tween/ease-in-cubic))))
|
||||||
|
|
||||||
(utils/intersects? (:fullscreen entities) [x y])
|
(utils/intersects? (:fullscreen entities) [x y])
|
||||||
(if (.isFullscreen Gdx/graphics)
|
(if (.isFullscreen Gdx/graphics)
|
||||||
|
|||||||
Reference in New Issue
Block a user