cannot espace without dropping the ball.

This commit is contained in:
2014-12-27 16:00:45 -08:00
parent e0f4dcf607
commit 193e530567
5 changed files with 32 additions and 12 deletions

View File

@@ -1 +1 @@
{:active? true, :convinced-wizard? true, :inventory [] :chest-contents [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength :sword ], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-jail, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :sword :flask-1 :grass :ladder :trophy}}
{:active? true, :convinced-wizard? true, :inventory [] :chest-contents [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength :sword ], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-jail, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :sword :flask-1 :grass :ladder :trophy} :time :night}

View File

@@ -1 +1 @@
{:active? true, :convinced-wizard? true, :inventory [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy}}
{:active? true, :convinced-wizard? true, :inventory [:ladder :flask-1 :grass :medal :kiss :trophy :flask-1-strength], :wizard-left? false, :clues #{}, :current-riddle :wool, :last-room :inside-castle, :wants-toy true, :mints-eaten 0, :object nil, :obtained-items #{:kiss :medal :flask-1 :grass :ladder :trophy} :time :day}

View File

@@ -12,6 +12,7 @@
[play-clj.g2d :refer :all]))
(defn go-to-jail [entities]
(actions/update-state entities #(assoc % :time :night))
(actions/update-state entities #(assoc % :chest-contents (concat (remove #{:key} (:inventory %)) (:chest-contents %))))
(actions/update-state entities #(assoc % :inventory []))
(actions/update-state entities #(assoc % :opened-bars? false))

View File

@@ -149,6 +149,22 @@
(actions/update-state entities #(assoc % :hay-searches (inc hay-searches)))))
(defn leave [entities]
(if (get-in @entities [:state :opened-bars?])
(do
(actions/walk-to entities :ego [279 57])
(if (chest-full? entities)
(actions/talk entities :ego "I probably shouldn't leave without my belongings.")
(do (actions/transition-background entities :outside-jail [50 46] )
(when (not (get-in @entities [:state :dropped-ball?]))
(actions/do-dialogue entities :ego "Yes I made it!"
:guard "Hmm?"
:guard "Halt! Thou art under arrest!"
:guard "Thou wilst be putteth back into thy cell.")
(common/go-to-jail entities)
(actions/do-dialogue entities :ego "Dang! I was so close to freedom, I could taste it!")))))
(actions/talk entities :ego "Do you really think I can walk down those steps while I'm locked up?")))
(defn make [screen]
@@ -183,14 +199,7 @@
:script (actions/get-script entities (touch-chest entities))}
:door {:box [257 62 301 152]
:cursor :down
:script (actions/get-script entities
(if (get-in @entities [:state :opened-bars?])
(do
(actions/walk-to entities :ego [279 57])
(if (chest-full? entities)
(actions/talk entities :ego "I probably shouldn't leave without my belongings.")
(actions/transition-background entities :outside-jail [50 46] )))
(actions/talk entities :ego "Do you really think I can walk down those steps while I'm locked up?")))}}
:script (actions/get-script entities (leave entities))}}
:layers [(assoc (texture "inside-jail/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-jail/bars.png") :x 0 :y 0 :baseline 165)
(assoc (texture "inside-jail/glow.png") :x 0 :y 0 :baseline 240)]

View File

@@ -11,7 +11,10 @@
(defn make [screen]
(let [fountain (utils/make-anim "outside-jail/fountain.png" [42 50] 0.2 (range 3))]
(let [fountain (utils/make-anim "outside-jail/fountain.png" [42 50] 0.2 (range 3))
guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87)
guard-stand (animation 0.1 [(aget guard-sheet 0 0)])
guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]] (aget guard-sheet 0 i)))]
(rooms/make :music :town-2
:interactions {:down-dir {:box [30 0 227 20]
:script (actions/get-script entities
@@ -66,6 +69,13 @@
:width 10
:height 10
:talk-color (color 0.9 0.3 0.9 1.0)}}
:guard (assoc (animation->texture screen guard-stand)
:x 70 :y 55 :baseline 185)
:collision "outside-jail/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 40 0.001 1.3)
:start-pos [145 15])))
:start-pos [145 15]
:apply-state (fn [entities]
(as-> entities entities
(if (= :night (get-in entities [:state :time]))
(assoc-in entities [:room :entities :guard] (get-in entities [:room :guard]))
entities))))))