able to get back to blergh.

This commit is contained in:
2015-01-08 16:36:27 -08:00
parent f41a9deae1
commit 16639ef14c
11 changed files with 106 additions and 71 deletions

View File

@@ -2,6 +2,8 @@
(:require [advent.screens.items :as items]
[advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common]
[advent.screens.rooms.outside-castle :as outside-castle]
[advent.screens.rooms.inside-castle :as inside-castle]
[advent.actions :as actions]
[advent.utils :as utils]
[clojure.zip :as zip]
@@ -11,6 +13,12 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn walk-to-castle [entities]
(actions/walk-to entities :ego [0 80])
(actions/walk-straight-to entities :ego [-20 80])
(actions/transition-background entities :outside-castle [330 80])
(actions/walk-straight-to entities :ego [310 80]))
(def ego-sheep-loc
[132 140])
@@ -21,6 +29,53 @@
(defn is-sheep-close? [entities]
(< (dist-to-sheep entities) 45))
(defn is-ready-for-slingshot [entities]
(and (actions/has-obtained? entities :broken-clock)
(not (actions/has-item? entities :broken-clock))
(actions/has-obtained? entities :money)
(not (actions/has-item? entities :money))))
(defn put-something-in-cauldron [item]
(condp = item
:money (actions/get-script entities
(actions/walk-to entities :ego [141 90] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :money)
(actions/talk entities :ego "I guess that's what you could call 'money in the pot'."))
:slingshot (actions/get-script entities
(if (is-ready-for-slingshot entities)
(do
(actions/walk-to entities :ego [141 90] :face :right)
(actions/talk entities :ego "Here goes!")
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :slingshot)
(actions/give entities :magic-slingshot)
(actions/do-dialogue entities
:ego "It worked!"
:ego "I now have The Slinger's Shot."
:ego "And just in time, too. It's getting light.")
(walk-to-castle entities)
(outside-castle/go-through-gate entities)
(inside-castle/walk-to-blergh entities))))
:broken-clock (actions/get-script entities
(actions/walk-to entities :ego [141 90] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :broken-clock)
(actions/talk entities :ego "Just in the nick of time."))
:recipe (actions/get-script entities
(actions/walk-to entities :ego [151 90] :face :right)
(actions/play-animation entities :ego :squat)
(actions/remove-item entities :recipe)
(actions/give entities :ash)
(actions/talk entities :ego "It burned up into ash."))
:spell-component (actions/get-script entities
(actions/walk-to entities :ego [141 90] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :spell-component)
(actions/talk entities :ego "I poured it in. Now what?"))
(actions/get-script entities
(actions/talk entities :ego "I don't want to put something in there unless I'm sure I need to."))))
(defn wizard-dialogue [entities]
(actions/do-dialogue entities :ego "Hello there [RED]Gandarf[]!" :wizard "Oh no, not you again!")
(actions/present-choices entities
@@ -206,10 +261,8 @@
:left-dir {:box [0 40 20 140]
:script (actions/get-script
entities
(actions/walk-to entities :ego [0 80])
(actions/walk-straight-to entities :ego [-20 80])
(actions/transition-background entities :outside-castle [330 80])
(actions/walk-straight-to entities :ego [310 80])
(walk-to-castle entities)
)
:cursor :left}}
:layers {:day [(assoc (texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0)
@@ -290,17 +343,7 @@
:anim cauldron
:anim-start 0
:script (actions/get-script entities (actions/talk entities :ego "That's a big cauldron!"))
:scripts {:recipe (actions/get-script entities
(actions/walk-to entities :ego [151 90] :face :right)
(actions/play-animation entities :ego :squat)
(actions/remove-item entities :recipe)
(actions/give entities :ash)
(actions/talk entities :ego "It burned up into ash."))
:spell-component (actions/get-script entities
(actions/walk-to entities :ego [141 90] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :spell-component)
(actions/talk entities :ego "I poured it in. Now what?"))}))
:scripts put-something-in-cauldron))
:wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2
:script (actions/get-script entities (talk-to-gandarf-outside entities))}))
:note (rooms/make-entity :note (assoc (texture "outsidehouse/note.png")