implemented library of items.

This commit is contained in:
2014-10-14 12:57:12 -07:00
parent de2a4f8c7c
commit 2c046134f8
7 changed files with 26 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
(ns advent.screens.rooms.behind-house
(:require [advent.screens.rooms :as rooms]
[advent.screens.items :as items]
[advent.actions :as actions]
[advent.utils :as utils]
[clojure.zip :as zip]
@@ -28,11 +29,11 @@
:mushrooms {:box [247 59 269 76]
:script (actions/get-script
entities
(if ((get-in @entities [:state :inventory]) :mushrooms)
(if (actions/has-item? @entities items/mushrooms)
(actions/talk entities :ego "I've already got a junk ton of mushrooms.")
(do
(actions/walk-to entities :ego [242 75])
(actions/give entities :mushrooms)
(actions/give entities items/mushrooms)
(actions/talk entities :ego "Perfectly ripe mushrooms!"))))}
:window {:box [103 44 130 140]
:script (actions/get-script

View File

@@ -1,5 +1,6 @@
(ns advent.screens.rooms.inside-house
(:require [advent.screens.rooms :as rooms]
(:require [advent.screens.items :as items]
[advent.screens.rooms :as rooms]
[advent.actions :as actions]
[advent.utils :as utils]
[clojure.zip :as zip]
@@ -34,7 +35,7 @@
:x 265 :y 80 :baseline 240
:script (actions/get-script entities
(actions/remove-entity entities :flask)
(actions/give entities :flask)
(actions/give entities items/flask)
(actions/do-dialogue entities :ego "Hey you think I could have this flask?"
:wizard "Sure.")))}
:collision "inside-house/collision.png"

View File

@@ -1,5 +1,6 @@
(ns advent.screens.rooms.outside-castle
(:require [advent.screens.rooms :as rooms]
(:require [advent.screens.items :as items]
[advent.screens.rooms :as rooms]
[advent.actions :as actions]
[advent.utils :as utils]
[clojure.zip :as zip]
@@ -31,12 +32,12 @@
:garden {:box [103 170 178 200]
:script (actions/get-script
entities
(if ((get-in @entities [:state :inventory]) :carrot)
(if (actions/has-item? @entities items/carrot)
(actions/talk entities :ego "If I steal any more, I might get caught.")
(do
(actions/walk-to entities :ego [128 180])
(actions/talk entities :ego "Hey! Carrots. No one will notice one missing.")
(actions/give entities :carrot))))}
(actions/give entities items/carrot))))}
:peddler {:box [110 90 128 146]
:script (actions/get-script
entities

View File

@@ -1,5 +1,6 @@
(ns advent.screens.rooms.outside-house
(:require [advent.screens.rooms :as rooms]
(:require [advent.screens.items :as items]
[advent.screens.rooms :as rooms]
[advent.actions :as actions]
[advent.utils :as utils]
[clojure.zip :as zip]
@@ -164,23 +165,23 @@
entities
(if ((get-in @entities [:state :inventory]) :wool)
(if (actions/has-item? @entities items/wool)
(actions/talk entities :ego "The sheep has given me enough wool.")
(if (is-sheep-close? @entities)
(do (actions/walk-to entities :ego ego-sheep-loc)
(actions/give entities :wool)
(actions/give entities items/wool)
(actions/talk entities :ego "I guess her wool is shedding."))
(actions/talk entities :ego "She's too far away for me to pet her."))))
:scripts {:wool (actions/get-script entities
:scripts {items/wool (actions/get-script entities
(actions/talk entities :ego "She doesn't need it back."))
:carrot (actions/get-script entities
items/carrot (actions/get-script entities
(actions/walk-to entities :ego ego-sheep-loc)
(actions/talk entities :ego "Come on girl, get the carrot!")
(actions/walk-straight-to entities :sheep [95 150]))
:flask (actions/get-script entities
items/flask (actions/get-script entities
(if (is-sheep-close? @entities)
(do (actions/walk-to entities :ego ego-sheep-loc)
(actions/give entities :flask-with-contents)
(actions/give entities items/flask-with-milk)
(actions/talk entities :ego "Sheeps milk."))
(actions/talk entities :ego "She's too far away.")))}
:left {:walk (utils/flip sheep-walk)