added safe puzzle
This commit is contained in:
@@ -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)))
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user