added pausing the camera.
This commit is contained in:
@@ -1 +1 @@
|
|||||||
{:sound-volume 56.0, :music-volume 30.0}
|
{:sound-volume 56.0, :music-volume 56.0}
|
||||||
@@ -432,6 +432,14 @@
|
|||||||
(can-skip? [this screen entities]
|
(can-skip? [this screen entities]
|
||||||
false)))
|
false)))
|
||||||
|
|
||||||
|
(defn pause-camera [entities]
|
||||||
|
(update-entities entities #(-> %
|
||||||
|
(assoc-in [:cam :paused? ] true)
|
||||||
|
(update-in [:tweens] dissoc :cam-x :cam-y))))
|
||||||
|
|
||||||
|
(defn resume-camera [entities]
|
||||||
|
(update-entities entities #(assoc-in % [:cam :paused? ] false)))
|
||||||
|
|
||||||
(defn begin-animation [entities target-id anim]
|
(defn begin-animation [entities target-id anim]
|
||||||
(run-action entities
|
(run-action entities
|
||||||
(begin [this screen entities]
|
(begin [this screen entities]
|
||||||
|
|||||||
@@ -17,12 +17,14 @@
|
|||||||
|
|
||||||
(defn play-battle [entities anim]
|
(defn play-battle [entities anim]
|
||||||
(actions/transition-music entities :fight)
|
(actions/transition-music entities :fight)
|
||||||
|
(actions/pause-camera entities)
|
||||||
(actions/add-entity entities :fight (get-in @entities [:room :fight]))
|
(actions/add-entity entities :fight (get-in @entities [:room :fight]))
|
||||||
(actions/add-entity entities :hands-fight (get-in @entities [:room :hands-fight]))
|
(actions/add-entity entities :hands-fight (get-in @entities [:room :hands-fight]))
|
||||||
(actions/play-animation entities :hands-fight anim)
|
(actions/play-animation entities :hands-fight anim)
|
||||||
(actions/transition-music entities nil)
|
(actions/transition-music entities nil)
|
||||||
(actions/remove-entity entities :hands-fight)
|
(actions/remove-entity entities :hands-fight)
|
||||||
(actions/remove-entity entities :fight))
|
(actions/remove-entity entities :fight)
|
||||||
|
(actions/resume-camera entities))
|
||||||
|
|
||||||
(defn do-warrior-dialogue [entities]
|
(defn do-warrior-dialogue [entities]
|
||||||
(actions/walk-to entities :ego [150 45] :face :left)
|
(actions/walk-to entities :ego [150 45] :face :left)
|
||||||
|
|||||||
@@ -142,6 +142,7 @@
|
|||||||
(defn pull-sword [entities]
|
(defn pull-sword [entities]
|
||||||
(actions/play-animation entities :ego :reach)
|
(actions/play-animation entities :ego :reach)
|
||||||
|
|
||||||
|
(actions/pause-camera entities)
|
||||||
(actions/transition-music entities :pull-sword)
|
(actions/transition-music entities :pull-sword)
|
||||||
(actions/add-entity entities :blackout (get-in @entities [:room :blackout]))
|
(actions/add-entity entities :blackout (get-in @entities [:room :blackout]))
|
||||||
(actions/add-entity entities :pull-sword (get-in @entities [:room :pull-sword]))
|
(actions/add-entity entities :pull-sword (get-in @entities [:room :pull-sword]))
|
||||||
@@ -151,6 +152,7 @@
|
|||||||
(actions/remove-entity entities :pull-sword)
|
(actions/remove-entity entities :pull-sword)
|
||||||
(actions/remove-entity entities :blackout)
|
(actions/remove-entity entities :blackout)
|
||||||
(particle-effect! (get-in @entities [:room :entities :magic]) :allow-completion)
|
(particle-effect! (get-in @entities [:room :entities :magic]) :allow-completion)
|
||||||
|
(actions/resume-camera entities)
|
||||||
(actions/transition-music entities nil)
|
(actions/transition-music entities nil)
|
||||||
(actions/do-dialogue entities :ego "That was weird."
|
(actions/do-dialogue entities :ego "That was weird."
|
||||||
:ego "I have to go show my friends!")
|
:ego "I have to go show my friends!")
|
||||||
|
|||||||
@@ -541,6 +541,7 @@
|
|||||||
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
|
||||||
|
:paused? false
|
||||||
: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")
|
||||||
@@ -619,8 +620,9 @@
|
|||||||
[id ((:update-fn entity) screen entities entity)]
|
[id ((:update-fn entity) screen entities entity)]
|
||||||
[id entity])))))
|
[id entity])))))
|
||||||
|
|
||||||
entities (if (and (nil? (get-in entities [:tweens :cam-x]))
|
entities (if (and (not (get-in entities [:cam :paused?]))
|
||||||
(= 1 (rand-int 20)))
|
(nil? (get-in entities [:tweens :cam-x]))
|
||||||
|
(= 1 (rand-int 20)))
|
||||||
(if (= (rand-int 2) 1)
|
(if (= (rand-int 2) 1)
|
||||||
(actions/pan-to screen entities
|
(actions/pan-to screen entities
|
||||||
(get-in entities [:room :entities :ego :x])
|
(get-in entities [:room :entities :ego :x])
|
||||||
@@ -642,12 +644,11 @@
|
|||||||
layers (get-layers entities)
|
layers (get-layers entities)
|
||||||
|
|
||||||
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
|
all-entities (concat (vals entities) layers (vals (get-in entities [:room :entities])))]
|
||||||
(when (nil? (:zoom (:cam entities)))
|
|
||||||
(println entities))
|
|
||||||
(screen! talking-screen :on-update-camera :scene-viewport (:viewport screen) :scene-camera (:camera screen))
|
(screen! talking-screen :on-update-camera :scene-viewport (:viewport screen) :scene-camera (:camera screen))
|
||||||
(set! (. camera zoom) (:zoom (:cam entities)))
|
(when (not (get-in entities [:cam :paused?]))
|
||||||
(set! (.. camera position x) (:x (:cam entities) 160.0))
|
(set! (. camera zoom) (:zoom (:cam entities)))
|
||||||
(set! (.. camera position y) (:y (:cam entities) 120.0))
|
(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)]
|
(let [entities (utils/update-override screen entities)]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user