This commit is contained in:
Bryce Covert
2021-09-08 08:00:59 -07:00
parent 23e87d6224
commit 8ee743e371
58 changed files with 340 additions and 255 deletions

View File

@@ -756,6 +756,7 @@
:none))
(log/info "Entering room " new-background )
(screen! dialogue/talking-screen :stop-talk { :id :bg-actions})
(run-action entities
(begin [this screen entities]
(utils/stop-all-sounds! entities)

View File

@@ -1,7 +1,7 @@
(ns advent.saves)
(def chapters
{:chapter-1 nil
{:chapter-1 {:state {:y 54.93726516381327, :active? true, :plaques-read #{}, :time :intro, :inventory [], :seen-intro? false, :clues #{}, :hud-active? false, :x 139.7490606552531, :last-room :dream, :mints-eaten 0, :object nil, :obtained-items #{}}}
:chapter-2 nil
:chapter-3 nil
:chapter-4 nil

View File

@@ -319,23 +319,29 @@
:cursor :hand
:label "Suspicous looking rock"
:script (actions/get-script entities
(when (and (actions/has-obtained? entities :note-1)
(if (and (actions/has-obtained? entities :note-1)
(not (actions/has-obtained? entities :walkie-talkies)))
(actions/walk-to entities :ego [85 99])
(actions/play-animation entities :ego :squat)
(actions/do-dialogue entities
:ego "Hey! A little lever."
:ego "I think this is Gandarf's secret stash of helpful stuff.")
(actions/play-animation entities :ego :squat)
(actions/give entities :alarm-clock)
(actions/do-dialogue entities :ego "What is this?")
(actions/play-animation entities :ego :squat)
(actions/give entities :camera)
(actions/do-dialogue entities :ego "These are all really strange devices.")
(actions/play-animation entities :ego :squat)
(actions/give entities :walkie-talkies)
(actions/talk entities :ego "Tin cans connected with string?")
(actions/do-dialogue entities :ego "I wonder what all of these magic devices do.")))}
(do
(actions/walk-to entities :ego [85 99])
(actions/play-animation entities :ego :squat)
(actions/do-dialogue entities
:ego "Hey! A little lever."
:ego "I think this is Gandarf's secret stash of helpful stuff.")
(actions/play-animation entities :ego :squat)
(actions/give entities :alarm-clock)
(actions/do-dialogue entities :ego "What is this?")
(actions/play-animation entities :ego :squat)
(actions/give entities :camera)
(actions/do-dialogue entities :ego "These are all really strange devices.")
(actions/play-animation entities :ego :squat)
(actions/give entities :walkie-talkies)
(actions/talk entities :ego "Tin cans connected with string?")
(actions/do-dialogue entities :ego "I wonder what all of these magic devices do."))
(do
(actions/walk-to entities :ego [85 99])
(actions/play-animation entities :ego :squat)
(actions/do-dialogue entities
:ego "I've looted everything in here!"))))}
:grass {:box [26 105 60 160]
:cursor :hand
:label "Grass"
@@ -492,7 +498,55 @@
:flask-water-flies (try-flask)
:flask-flies-ash (try-flask)
:spell-component (try-flask)
:glass-eye (actions/get-script entities
(cond
(actions/has-obtained? entities :feather)
(do (actions/walk-to entities :ego [141 54] :face :right)
(actions/do-dialogue entities
:ego "Could you use this as a monocle?"
:owl "You already gave me my monocle, silly boy!"))
(get-in @entities [:state :wants-monocle?])
(do
(actions/walk-to entities :ego [141 54] :face :right)
(actions/do-dialogue entities
:ego "Could you use this glass eye as a monocle?"
:owl "It is the choicest of eyes."
:owl "But a human eye won't fit.")
(do-puke entities))
:else
(actions/talk entities :ego "Why would an owl want that?")))
:motivational-tapes (actions/get-script entities
(cond
(get-in @entities [:state :wants-monocle?])
(do
(actions/walk-to entities :ego [141 54] :face :right)
(actions/do-dialogue entities
:ego "Could these motivational tapes help you hunt?"
:owl "I already have the strength of will."
:owl "Just not the strength of stomach.")
(do-puke entities))
:else
(actions/talk entities :ego "Why would an owl want that?")))
:earplugs (actions/get-script entities
(cond
(get-in @entities [:state :wants-monocle?])
(do
(actions/walk-to entities :ego [141 54] :face :right)
(actions/do-dialogue entities
:ego "Could these earplugs help you hunt?"
:owl "No, I rely on my hearing too much.")
(do-puke entities))
:else
(actions/talk entities :ego "Why would an owl want that?")))
:flask-1-strength (actions/get-script entities
(cond
(get-in @entities [:state :wants-monocle?])

View File

@@ -123,6 +123,7 @@
(fn [screen entities]
(tween/tween :arm-y screen [:room :entities :arm :y] 240 70 3.0 :ease tween/ease-linear)))
(actions/transition-background entities :tongue-fight [141 240])
(actions/walk-straight-to entities :ego [141 110] :anim :tongue-idle :speed 4.0))

View File

@@ -140,7 +140,7 @@
:script (actions/get-script entities
(actions/talk entities :ego "That's my house. I'd rather play outside."))}
:sherrif-house {:box [138 143 160 168]
:label "Sherriff's house"
:label "Sheriff's house"
:cursor :look
:script (actions/get-script entities
(actions/do-dialogue entities

View File

@@ -364,6 +364,7 @@
:scale-fn (constantly 1.0)
:start-pos [141 110]
:apply-state (fn [screen e]
(screen! @(resolve 'advent.screens.scene/hud) :on-tongue-fight {})
(-> e
(update-in [:room :entities :ego] #(actions/start-animation screen % :tongue-idle))
(assoc-in [:room :entities :ego :stand-override] :tongue-idle)

View File

@@ -1515,7 +1515,6 @@
)))
:on-tap (fn [screen entities options]
(println "tapping")
(when utils/mobile?
(handle-touch-up screen entities options)))
@@ -1551,6 +1550,7 @@
(screen! toast-screen :on-toast { :message (str "Saved \"" save-name "\"")}))))
:on-menu (fn [{:keys [viewport] :as screen} entities options]
(println "HERE TESTTTT")
(when-not (or (get-in entities [:tweens :fade-out])
(get-in entities [:tweens :fade-in]))
@@ -1621,7 +1621,7 @@
(let [scene-entities (-> scene :entities deref)]
(and (not (get-in scene-entities [:fg-actions :script-running?]))
(get-in scene-entities [:state :active?])
(not= (get-in scene-entities [:state :last-room]) :tongue-fight)
(= 0.0 (get-in scene-entities [:fade :opacity])))))
(defmulti transition-hud (fn [screen entities new-state state-data]
@@ -1960,11 +1960,15 @@
:x (- 320 (* utils/ui-scale 16) 4) :y 240
:origin-x 16 :origin-y 16
:width 16 :height 16
:enabled? (not= (get-in (-> scene :entities deref) [:state :last-room])
:tongue-fight)
:baseline 9000
:opacity 0.8)
:inventory (assoc (utils/atlas->texture global-atlas "inventory") :x (* 21 utils/ui-scale ) :y (* 27 utils/ui-scale ) :baseline 9000
:intersect-width 42 :intersect-height 48
:width 42 :height 56
:enabled? (not= (get-in (-> scene :entities deref) [:state :last-room])
:tongue-fight)
:origin-x 21 :origin-y 27
:scale-x utils/ui-scale :scale-y utils/ui-scale
:open (utils/flip (doto (utils/make-anim-seq global-atlas "open-inventory" [42 56] 0.055 (flatten [(range 6) 6 7 8 7 ]))
@@ -1981,6 +1985,13 @@
:fps (->> (assoc (label "" (color :white) ) :y 10 :x 280 :baseline 0 :opacity 0.1)
(utils/add-actor-to-stage screen))}))
:on-tongue-fight
(fn [screen entities options]
(println "OPTIONS ARE" screen)
(-> entities
(assoc-in [:inventory :enabled?] false)
(assoc-in [:save :enabled?] false)))
:on-render
(fn [{:keys [^FitViewport viewport] :as screen} entities options]
(.apply viewport)
@@ -2008,17 +2019,22 @@
(update-in entities [:save] assoc :r 0.75 :g 0.75 :b 0.75)
(grow-hud screen entities :save false)))
entities (or (process-fsm screen entities) entities)]
entities (or (process-fsm screen entities) entities)
on-tongue-fight? (= :tongue-fight
(get-in (-> scene :entities deref) [:state :last-room]))]
#_(label! (:fps entities) :set-text (str (game :fps)))
(render-one screen (if (and hud-interactable? (not (:already-saved? entities)))
(:save entities)
(assoc (:save entities) :opacity 0.5)))
(render-one screen (if hud-interactable?
(:inventory entities)
(assoc (:inventory entities) :opacity 0.5)))
(when (:enabled? (:save entities))
(render-one screen (if (and hud-interactable? (not (:already-saved? entities)))
(:save entities)
(assoc (:save entities) :opacity 0.5))))
(when (:enabled? (:inventory entities))
(render-one screen (if hud-interactable?
(:inventory entities)
(assoc (:inventory entities) :opacity 0.5))))
(render-one screen (:selected-item entities))
(render-one screen (:close entities))
entities))
@@ -2116,6 +2132,7 @@
:on-tap
(fn [screen entities options]
(println "is enabled?" (:enabled? (:inventory entities)))
(if (= (button-code :left) (:button options))
(let [[x y] (utils/unproject screen options)]
(cond
@@ -2123,7 +2140,8 @@
nil
(utils/intersects? (:inventory entities) [x y])
(and (utils/intersects? (:inventory entities) [x y])
(:enabled? (:inventory entities)))
(if (= :selected (get-in entities [:inv-fsm :state]))
(update-in entities [:inv-fsm :pending-states] conj [:none (get-in entities [:inv-fsm :state-data])])
@@ -2135,7 +2153,7 @@
(utils/intersects? (:close entities) [x y])
(screen! scene :on-menu {})
(and (not (:already-saved? entities)) (utils/intersects? (:save entities) [x y]) (hud-interactable?))
(and (not (:already-saved? entities)) (utils/intersects? (:save entities) [x y]) (hud-interactable?) (:enabled? (:save entities)))
(do
(screen! scene :on-save {})
(assoc entities :already-saved? true))