diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj index e8bd994d..c0ccb80d 100644 --- a/desktop/src-common/advent/screens/rooms/dream.clj +++ b/desktop/src-common/advent/screens/rooms/dream.clj @@ -1,5 +1,7 @@ (ns advent.screens.rooms.dream - (:require [advent.screens.rooms :as rooms] + (:require + [clojure.core.async :as a] + [advent.screens.rooms :as rooms] [advent.screens.rooms.common :as common] [advent.actions :as actions] [advent.screens.items :as items] @@ -12,12 +14,22 @@ [play-clj.utils :refer :all] [play-clj.g2d :refer :all])) +(def walk-chan (a/chan)) +(defn do-intro [entities] + (a/go + (actions/do-dialogue entities + :ego "Oh hi there!" + :ego "I'm Faceplant, the great knight, and this is my dream!" + :ego "Just like in real life, I can walk around if you just click somewhere on the screen." + :ego "Give it a shot, whydontya?") + (actions/walk-to entities :ego [100 100]) + (actions/talk entities :ego "I can also pick up stuff by clicking on it."))) (defn make [screen] (rooms/make :music :town-1 - :interactions - {} + :interactions {:floor {:box [0 0 320 170] + :script (actions/get-script entities (a/>! [100 100]))}} :layers [(assoc (texture "dream/background.png") :x 0 :y 0 :baseline 0)] :entities {} :collision "space/background.png" diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 266930a0..f5a19548 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -346,7 +346,9 @@ :obtained-items #{} :inventory [] :clues #{} - :mints-eaten 0})) + :mints-eaten 0 + :seen-intro? false})) + (defscreen scene :on-timer (fn [screen [entities]] @@ -402,6 +404,8 @@ (doseq [[k [start time fn]] (get-in entities [:room :timers])] (add-timer! screen k start time)) + (when (not (get-in entities [:state :seen-intro?])) + ((actions/get-script entities (rooms.dream/do-intro entities)) entities)) (if-let [apply-state (get-in entities [:room :apply-state])] (apply-state entities) entities))))