ladder now breaks.

This commit is contained in:
Bryce Covert
2015-08-15 23:28:35 -07:00
parent a04259a9da
commit df02a78419
4 changed files with 37 additions and 11 deletions

View File

@@ -33,4 +33,5 @@
+can walk to top corner in house screen +can walk to top corner in house screen
+ ladder should break
+ ladder can be lost by doing script on ladder

View File

@@ -9,13 +9,19 @@
[play-clj.ui :refer :all] [play-clj.ui :refer :all]
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all])) [play-clj.g2d :refer :all]))
(defn get-down [entities] (defn get-down [entities & break]
(actions/walk-straight-to entities :ego [151 50] :update-baseline? false :face :left) (actions/walk-straight-to entities :ego [151 50] :update-baseline? false :face :left)
(actions/play-animation entities :ego :reach) (if break
(actions/remove-entity entities :blank) (do (actions/play-animation entities :ladder :destroy-ladder :stop? false)
(actions/remove-entity entities :ladder) (actions/remove-entity entities :blank)
(actions/give entities :ladder)) (actions/remove-entity entities :ladder)
(actions/play-animation entities :ego :sigh))
(do (actions/play-animation entities :ego :reach)
(actions/remove-entity entities :blank)
(actions/remove-entity entities :ladder)
(actions/give entities :ladder))))
(defn do-saved-grandma-dialogue [entities] (defn do-saved-grandma-dialogue [entities]
(actions/walk-to entities :ego [165 45] :face :left) (actions/walk-to entities :ego [165 45] :face :left)
@@ -201,7 +207,10 @@
cat-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0])] cat-stand (animation 0.15 (for [i (flatten [(repeat 10 0) 1 1 (repeat 10 0) 2 3 4 3 0 0 2 3 4 3 (repeat 10 0) 1 1 (repeat 10 0) 5 5 6 6 7 (repeat 10 [7 8]) 6 5 0])]
(aget cat-stand-sheet 0 i))) (aget cat-stand-sheet 0 i)))
cat-walk (animation 0.2 [(texture "cat-tree/pounce.png")]) cat-walk (animation 0.2 [(texture "cat-tree/pounce.png")])
ladder-entity (assoc (texture "inside-cafeteria/ladder.png") :x 120 :y 60 :baseline 162) destroy-ladder (utils/make-anim "cat-tree/destroy-ladder.png" [29 38] 0.075 (range 18))
ladder-entity (assoc (texture "inside-cafeteria/ladder.png") :x 130 :y 60 :baseline 162
:origin-x 0
:destroy-ladder destroy-ladder)
grandma-stand (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1]) grandma-stand (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1])
grandma-squat-1 (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [3 4 5 5 5 5 5]) grandma-squat-1 (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [3 4 5 5 5 5 5])
grandma-squat-2 (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [5 5 4 3]) grandma-squat-2 (utils/make-anim "cat-tree/grandma.png" [25 36] 0.2 [5 5 4 3])
@@ -304,7 +313,7 @@
(actions/remove-entity entities :cat) (actions/remove-entity entities :cat)
(actions/play-animation entities :grandma :squat-2) (actions/play-animation entities :grandma :squat-2)
(actions/do-dialogue entities :grandma "Thank you for rescuing my furry friend, young man!") (actions/do-dialogue entities :grandma "Thank you for rescuing my furry friend, young man!")
(get-down entities) (get-down entities true)
(actions/walk-straight-to entities :ego [165 45] :face :left) (actions/walk-straight-to entities :ego [165 45] :face :left)
(actions/do-dialogue entities (actions/do-dialogue entities
:ego "It's no big deal." :ego "It's no big deal."

View File

@@ -122,6 +122,22 @@
{:run #(actions/respond entities %)}]} {:run #(actions/respond entities %)}]}
"Something else." "Something else."
{:choices actions/something-else}]} {:choices actions/something-else}]}
(when (and (actions/has-obtained? entities :ladder))
"About that ladder...")
{:run #(if (actions/has-item? entities :ladder?)
(actions/respond entities %
:ladder-guard "I trusteth it is safe in thy possession?"
:ego "Yes, it sure is!"
:ego "Can I borrow it a while longer?"
:ladder-guard "Yes, but do not durst tell a soul!")
(actions/respond entities %
:ladder-guard "I trusteth it is safe in thy possession?"
:ego "Ahem..."
:ego "... Yes, it sure is!"
:ladder-guard "I senseth some uncertainty in thine voice."
:ego "No uncertainty here!"))
:choices actions/previous-choices}
"Why aren't you sitting and eating?" "Why aren't you sitting and eating?"
{:run #(do (actions/respond entities % :ladder-guard "I'm on duty, young sire.") {:run #(do (actions/respond entities % :ladder-guard "I'm on duty, young sire.")
(when (not (actions/has-obtained? entities :ladder)) (when (not (actions/has-obtained? entities :ladder))
@@ -214,7 +230,7 @@
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.3) :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.3)
:apply-state (fn [_ entities] :apply-state (fn [_ entities]
(as-> entities entities (as-> entities entities
(if (actions/has-item? entities :ladder) (if (actions/has-obtained? entities :ladder)
(update-in entities [:room :entities] #(dissoc % :ladder)) (update-in entities [:room :entities] #(dissoc % :ladder))
entities))) entities)))
:start-pos [300 55]))) :start-pos [300 55])))

View File

@@ -86,11 +86,11 @@
:warden "The Duke of Remington is a very stern chap." :warden "The Duke of Remington is a very stern chap."
:warden "He doesn't bend the rules, even for young thieves.") :warden "He doesn't bend the rules, even for young thieves.")
:choices actions/previous-choices} :choices actions/previous-choices}
"Took, son of Luke, son of Puke gave me that ladder!" "Took, son of Luke, son of Puke lended me that ladder!"
{:run #(actions/respond entities % {:run #(actions/respond entities %
:warden "It wasn't his to give." :warden "It wasn't his to give."
:warden "In fact, he's off to the gallows come dawn." :warden "In fact, he's off to the gallows come dawn."
:ego "Oh, no.") :ego "Oh boy.")
:choices actions/previous-choices} :choices actions/previous-choices}
"But I was going to teach Bloodclot a lesson!" "But I was going to teach Bloodclot a lesson!"
{:run #(actions/respond entities % {:run #(actions/respond entities %