made it so you can make the spell componoent.

This commit is contained in:
2014-12-28 12:54:38 -08:00
parent 262291d6ec
commit 527c6eefe2
6 changed files with 37 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -38,6 +38,23 @@
(actions/give entities :flask-water-ash)
(actions/talk entities :ego "I added the ashes to the water.")))
(defn make-water-and-flies []
(actions/get-script entities
(actions/remove-item entities :flask-water)
(actions/remove-item entities :flies)
(actions/give entities :flask-water-flies)
(actions/talk entities :ego "I put those flies in the flask.")))
(defn make-flies-ash []
(actions/get-script entities
(actions/remove-item entities :flask-water)
(actions/remove-item entities :flask-water-ash)
(actions/remove-item entities :flask-water-flies)
(actions/remove-item entities :ash)
(actions/remove-item entities :flies)
(actions/give entities :flask-flies-ash)
(actions/talk entities :ego "Now it's got the fountain water, flies, and the ashes in it.")))
(def items
{:wool {:name "Wool" :value :wool :cursor :wool :scripts {:stick make-cat-toy}}
:mushrooms {:name "Mushrooms" :value :mushrooms :cursor :mushrooms
@@ -83,9 +100,11 @@
:rope {:name "Rope" :value :rope :cursor :rope}
:crowbar {:name "Crowbar" :value :crowbar :cursor :crowbar}
:flask-2 {:name "Flask" :value :flask-2 :cursor :flask}
:flask-water {:name "Water from fountain" :value :flask-water :cursor :flask :scripts {:ash (make-water-and-ash)}}
:flask-water-ash {:name "Water and ashes" :value :flask-water-ash :cursor :flask-with-contents}
:flask-water {:name "Water from fountain" :value :flask-water :cursor :flask :scripts {:ash (make-water-and-ash) :flies (make-water-and-flies)}}
:flask-water-ash {:name "Water and ashes" :value :flask-water-ash :cursor :flask-with-contents :scripts {:flies (make-flies-ash)}}
:flask-water-flies {:name "Water and flies" :value :flask-water-flies :cursor :flask-with-contents :scripts {:ash (make-flies-ash)}}
:flask-flies-ash {:name "Water, flies, and ash" :value :flask-flies-ash :cursor :flask-with-contents}
: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)}}
: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)}}})

View File

@@ -8,7 +8,7 @@
width (or width (.getRegionWidth region))
height (or height (.getRegionHeight region))]
((zone/box entity-x entity-y (+ entity-x (* width (or 1 scale-x))) (+ entity-y (* height (or scale-y 1)))) x y)))}
(when (:script entity)
(when (or (:scripts entity) (:script entity))
{:get-script (fn [cursor [x y]]
(if (= :main cursor)
(:script entity)

View File

@@ -239,7 +239,16 @@
:y 175
:anim flies-stand
:anim-start 0
:baseline 240)}
:baseline 240
:scripts {:sack-lunch (actions/get-script entities
(actions/walk-to entities :ego [168 150] :face :right)
(actions/talk entities :ego "Maybe I can catch some of these flies.")
(actions/remove-item entities :sack-lunch)
(actions/play-animation entities :ego :squat)
(actions/talk entities :ego "I think it's working!")
(actions/play-animation entities :ego :squat)
(actions/give entities :flies)
(actions/talk entities :ego "Hopefully they won't fly out of my backpack."))})}
:collision "outside-castle/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:start-pos [310 80]

View File

@@ -140,12 +140,12 @@
(actions/give entities :flask-2))))
(defn add-wizard-if-necessary [entities]
(if (actions/has-item? entities :flask-water)
(if (actions/has-obtained? entities :flask-water)
entities
(update-in entities [:room :entities] #(assoc % :wizard (get-in entities [:room :wizard])))))
(defn add-note-if-necessary [entities]
(if (and (actions/has-item? entities :flask-water)
(if (and (actions/has-obtained? entities :flask-water)
(not (actions/has-obtained? entities :note-1)))
(update-in entities [:room :entities] #(assoc % :note (get-in entities [:room :note])))
entities))

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])
(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])
(defn cursor [filename which]
(let [scale 2