started intro.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
(ns advent.screens.rooms.dream
|
(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.screens.rooms.common :as common]
|
||||||
[advent.actions :as actions]
|
[advent.actions :as actions]
|
||||||
[advent.screens.items :as items]
|
[advent.screens.items :as items]
|
||||||
@@ -12,12 +14,22 @@
|
|||||||
[play-clj.utils :refer :all]
|
[play-clj.utils :refer :all]
|
||||||
[play-clj.g2d :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]
|
(defn make [screen]
|
||||||
(rooms/make :music :town-1
|
(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)]
|
:layers [(assoc (texture "dream/background.png") :x 0 :y 0 :baseline 0)]
|
||||||
:entities {}
|
:entities {}
|
||||||
:collision "space/background.png"
|
:collision "space/background.png"
|
||||||
|
|||||||
@@ -346,7 +346,9 @@
|
|||||||
:obtained-items #{}
|
:obtained-items #{}
|
||||||
:inventory []
|
:inventory []
|
||||||
:clues #{}
|
:clues #{}
|
||||||
:mints-eaten 0}))
|
:mints-eaten 0
|
||||||
|
:seen-intro? false}))
|
||||||
|
|
||||||
(defscreen scene
|
(defscreen scene
|
||||||
:on-timer
|
:on-timer
|
||||||
(fn [screen [entities]]
|
(fn [screen [entities]]
|
||||||
@@ -402,6 +404,8 @@
|
|||||||
|
|
||||||
(doseq [[k [start time fn]] (get-in entities [:room :timers])]
|
(doseq [[k [start time fn]] (get-in entities [:room :timers])]
|
||||||
(add-timer! screen k start time))
|
(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])]
|
(if-let [apply-state (get-in entities [:room :apply-state])]
|
||||||
(apply-state entities)
|
(apply-state entities)
|
||||||
entities))))
|
entities))))
|
||||||
|
|||||||
Reference in New Issue
Block a user