added safe puzzle

This commit is contained in:
2014-11-10 17:50:10 -08:00
parent cb410354a8
commit 34f5c0474e
2 changed files with 15 additions and 5 deletions

View File

@@ -6,6 +6,7 @@
[advent.screens.scene :as scene]
[advent.screens.dialogue :as dialogue]
[advent.screens.inventory :as inventory]
[advent.screens.safe :as safe]
[clojure.pprint]
[advent.pathfind])
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter]
@@ -16,4 +17,4 @@
(defgame advent
:on-create
(fn [this]
(set-screen! this scene/scene dialogue/talking-screen dialogue/choice-screen inventory/inventory-screen)))
(set-screen! this scene/scene dialogue/talking-screen dialogue/choice-screen inventory/inventory-screen safe/safe-screen)))

View File

@@ -1,6 +1,7 @@
(ns advent.screens.rooms.inside-house
(:require [advent.screens.items :as items]
[advent.screens.rooms :as rooms]
[advent.screens.safe :as safe]
[advent.actions :as actions]
[advent.utils :as utils]
[clojure.zip :as zip]
@@ -9,6 +10,17 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn open-safe [entities]
(screen! safe/safe-screen :show-screen
:success (actions/get-script entities
(actions/talk entities :ego "Yes! That worked.")
(actions/play-animation entities :ego :squat)
(actions/give entities items/frog-legs)
(actions/talk entities :ego "I found some frog legs inside."))
:failure (actions/get-script entities
(actions/talk entities :ego "I don't think that worked...")))
(actions/update-state entities #(assoc % :active? false)))
(defn do-wizard-dialogue [entities]
(actions/do-dialogue entities :wizard "What can I do for you boy?")
(actions/present-choices entities
@@ -42,10 +54,7 @@
(actions/walk-to entities :ego [59 65])
(if (get-in @entities [:room :entities :wizard])
(actions/talk entities :wizard "Don't touch my MagiSafe!!")
(do
(actions/play-animation entities :ego :squat)
(actions/give entities items/frog-legs)
(actions/talk entities :ego "I found some frog legs inside."))))}
(open-safe entities)))}
}
:layers [(assoc (texture "inside-house/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-house/desk.png") :x 0 :y 0 :baseline 200)