started intro.

This commit is contained in:
2015-01-20 07:15:17 -08:00
parent ff00749c50
commit 6636538f0c
2 changed files with 20 additions and 4 deletions

View File

@@ -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"

View File

@@ -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))))