rewindable.

This commit is contained in:
Bryce Covert
2015-10-05 21:20:37 -07:00
parent 4a40e0f2cf
commit 6ff5f58c12
2 changed files with 56 additions and 37 deletions

View File

@@ -8,6 +8,7 @@ PROGRAMMING
+ behind house left direction not great
+ spying broken
+ still can get into dialogue deadlock somehow
+ Go backwards on load.
IOS
+ all mp3s

View File

@@ -124,43 +124,49 @@
(let [ui-skin (skin "ui/ui.json")]
(->
(slider {:min 0 :max 100 :step 1} ui-skin :set-value initial-value)
(assoc :width 300
(assoc :width 305
:hover (skin! ui-skin :get "default-horizontal-hover" Slider$SliderStyle)
:default (skin! ui-skin :get "default-horizontal" Slider$SliderStyle)
:z 8))))
(defn stack-y [label base index]
(assoc label :y (- 280 (* 32 index))))
(assoc label :y (- base (* 32 index))))
(defn main-menu []
{:start-playing (-> (make-label (quest-label))
(stack-y 280 0)
(assoc :z 8
:interactable true))
(let [start-playing-label (quest-label)
is-starting? (= "Begin quest" start-playing-label)]
{:start-playing (-> (make-label start-playing-label)
(stack-y 305 0)
(assoc :z 8
:interactable true))
:rewind (-> (make-label "Previous chapter" (color :white))
(stack-y 305 1)
(assoc :z 8
:interactable (not is-starting?)))
:music-label (-> (make-label "Music" (color :white))
(stack-y 280 1)
(assoc :z 8))
:music-label (-> (make-label "Music" (color :white))
(stack-y 305 2)
(assoc :z 8))
:music-volume-slider (-> (make-slider (:music-volume @utils/settings))
center
(stack-y 280 2)
(assoc :z 8))
:music-volume-slider (-> (make-slider (:music-volume @utils/settings))
center
(stack-y 305 3)
(assoc :z 8))
:sound-label (-> (make-label "FX" (color :white))
(stack-y 280 3)
(assoc :z 8))
:sound-volume-slider (-> (make-slider (:sound-volume @utils/settings))
center
(stack-y 280 4)
(assoc :z 8))
:sound-label (-> (make-label "FX" (color :white))
(stack-y 305 4)
(assoc :z 8))
:sound-volume-slider (-> (make-slider (:sound-volume @utils/settings))
center
(stack-y 305 5)
(assoc :z 8))
:fullscreen (-> (make-label "Fullscreen")
(stack-y 280 5)
(assoc :z 8 :interactable true))
:quit (-> (make-label "End quest")
(stack-y 280 6)
(assoc :z 8 :interactable true))})
:fullscreen (-> (make-label "Fullscreen")
(stack-y 305 6)
(assoc :z 8 :interactable true))
:quit (-> (make-label "End quest")
(stack-y 305 7)
(assoc :z 8 :interactable true))}))
(defn get-selected-save [entities [x y]]
(first (filter
@@ -168,16 +174,17 @@
(vals entities))))
(defn saves-menu []
(doto
(into {}
(for [[name index] (map #(vector %1 %2)
(utils/snapshot-list) (range))]
[name (-> (make-label name)
(stack-y 280 index)
(assoc :z 8
:interactable true
:save (saves/name->save name)))]))
println))
(into {:back (-> (make-label "Back")
(stack-y 305 7)
(assoc :z 8
:interactable true))}
(for [[name index] (map #(vector %1 %2)
(utils/snapshot-list) (range))]
[name (-> (make-label name)
(stack-y 305 index)
(assoc :z 8
:interactable true
:save (saves/name->save name)))])))
(defscreen title-screen
:on-show
@@ -224,7 +231,7 @@
:ego-jet (assoc (particle-effect "particles/jet" :reset :start) :x 450 :y 650 :z 4)
:toolbox (-> (assoc (nine-patch {:region (:object (utils/get-texture "talk-bg-2.png")) :left 9 :top 9 :right 9 :bottom 9})
:y 58 :width 500 :height 282
:y 58 :width 500 :height 297
:z 7)
center)
:main-menu (main-menu)
@@ -294,6 +301,13 @@
selected-save (get-selected-save entities [x y])]
(cond
(utils/intersects? (:start-playing entities) [x y])
(start-playing screen entities (if (= "Begin quest" (quest-label))
nil
:autosave))
(and (utils/intersects? (:rewind entities) [x y])
(-> entities :rewind :interactable))
(-> (apply dissoc entities (keys (:main-menu entities)))
(merge (:saves-menu entities)))
@@ -303,6 +317,10 @@
(utils/intersects? (:fullscreen entities) [x y])
(utils/toggle-fullscreen!)
(and (:back entities) (utils/intersects? (:back entities) [x y]))
(-> (apply dissoc entities (keys (:saves-menu entities)))
(merge (:main-menu entities)))
selected-save
(start-playing screen entities (:save selected-save))