can grab spear.

This commit is contained in:
2014-12-28 15:17:38 -08:00
parent a947a6467e
commit 5ffc811dc0
5 changed files with 20 additions and 3 deletions

View File

@@ -107,4 +107,5 @@
:note-1 {:name "Note from Gandarf" :value :note-1 :cursor :note-1}
:ash {:name "Ashes" :value :ash :cursor :ash :scripts {:flask-water (make-water-and-ash) :flask-water-flies (make-flies-ash)}}
:sack-lunch {:name "Sack lunch" :value :sack-lunch :cursor :sack-lunch}
:flies {:name "Flies" :value :flies :cursor :flies :scripts {:flask-water (make-water-and-flies) :flask-water-ash (make-flies-ash)}}})
:flies {:name "Flies" :value :flies :cursor :flies :scripts {:flask-water (make-water-and-flies) :flask-water-ash (make-flies-ash)}}
:spear {:name "Spear" :value :spear :cursor :spear}})

View File

@@ -9,10 +9,16 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn add-spear-if-necessary [entities]
(if (and (not (actions/has-obtained? entities :spear))
(get-in entities [:state :dropped-ball?]))
(assoc-in entities [:room :entities :spear] (get-in entities [:room :spear]))
entities))
(defn make-night [entities]
(-> entities
(assoc-in [:room :entities :guard] (get-in entities [:room :guard]))))
(assoc-in [:room :entities :guard] (get-in entities [:room :guard]))
add-spear-if-necessary))
(defn search-guard [entities]
(actions/walk-to entities :ego [121 75] :face :left)
@@ -24,6 +30,13 @@
:ego "Looks like it's pretty mangled from his spill.")
(actions/give entities :sack-lunch))))
(defn grab-spear [entities]
(actions/walk-to entities :ego [76 49] :face :left)
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :spear)
(actions/give entities :spear)
(actions/talk entities :ego "I guess he won't need this anymore."))
(defn make [screen]
(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)
@@ -99,6 +112,9 @@
:talk guard-talk
:sleep guard-sleep
:script (actions/get-script entities (search-guard entities))))
:spear (rooms/make-entity :spear (assoc (texture "outside-jail/spear.png")
:x 60 :y 65 :baseline 180
:script (actions/get-script entities (grab-spear entities))))
:collision "outside-jail/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 40 0.001 1.3)
:start-pos [145 15]

View File

@@ -14,7 +14,7 @@
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
(println (:input-x screen) (:input-y screen) "->" x y)))
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies])
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear])
(defn cursor [filename which]
(let [scale 2