started save menu.

This commit is contained in:
Bryce Covert
2015-09-25 22:16:29 -07:00
parent edd7e59fdd
commit c732d15750

View File

@@ -93,7 +93,7 @@
"Continue quest"
"Begin quest"))
(defn start-playing [screen entities]
(defn start-playing [screen entities save]
(do (input! :set-cursor-image (utils/cursor "cursor.png" :hourglass) 0 0)
(-> entities
(assoc-in [:tweens :fade-out]
@@ -162,8 +162,15 @@
(defn saves-menu []
{"Where we left off" (-> (make-label "Where we left off")
(stack-y 280 0)
(assoc :z 8))})
(stack-y 280 0)
(assoc :z 8
:interactable true
:save "Where we left off"))
"Our tale's beginning" (-> (make-label "Our tale's beginning")
(stack-y 280 1)
(assoc :z 8
:interactable true
:save "Our tale's beginning"))})
(defscreen title-screen
:on-show
@@ -213,6 +220,7 @@
:z 7)
center)
:main-menu (main-menu)
:saves-menu (saves-menu)
:font font
:music music
:volume 1.0
@@ -224,7 +232,7 @@
(utils/play-sound (:music %)) %)
:ease tween/ease-in-quadratic)}}
]
(merge entities (:main-menu entities)))))
(merge entities (:main-menu entities)))))
:on-render
(fn [{:keys [^FitViewport viewport] :as screen} [entities]]
@@ -273,17 +281,25 @@
entities)
:on-touch-up (fn [screen [entities]]
(println "HERE")
(when-not (get-in entities [:tweens :fade-out])
(let [[x y] (utils/unproject screen)]
(cond
(utils/intersects? (:start-playing entities) [x y])
(start-playing screen entities)
(-> (apply dissoc entities (keys (:main-menu entities)))
(merge (:saves-menu entities)))
(utils/intersects? (:quit entities) [x y])
(quit screen entities)
(utils/intersects? (:fullscreen entities) [x y])
(utils/toggle-fullscreen!)
(utils/intersects? (entities "Where we left off") [x y])
(start-playing screen entities "Where we left off")
(utils/intersects? (entities "Our tale's beginning") [x y])
(start-playing screen entities "Our tale's beginning")
:else
nil))))