fighting bloodclot coming along

This commit is contained in:
2015-02-15 01:20:52 -08:00
parent 63a4ba065a
commit 8d93158af0
29 changed files with 122 additions and 14 deletions

View File

@@ -161,7 +161,7 @@
(can-skip? [this screen entities]
false))))
(defn play-animation [entities target-id anim & {:keys [stop?]}]
(defn play-animation [entities target-id anim & {:keys [stop? continue?]}]
(run-action entities
(begin [this screen entities]
(update-in entities [:room :entities target-id] #(start-animation screen % anim) ))
@@ -174,9 +174,11 @@
(- (:total-time screen) (get-in entities [:room :entities target-id :anim-start]))))
(terminate [this screen entities]
(if (or (nil? stop?) stop?)
(stop screen entities target-id)
(assoc-in entities [:room :entities target-id :anim] nil)))
(if continue?
entities
(if (or (nil? stop?) stop?)
(stop screen entities target-id)
(assoc-in entities [:room :entities target-id :anim] nil))))
(can-skip? [this screen entities]
false)))

View File

@@ -159,12 +159,11 @@
#_(actions/play-animation entities :ego :swing)
(actions/do-dialogue entities :blergh "Ha ha ha! Is that the best you can do?"
:blergh "Take this!")
(actions/play-animation entities :blergh :swing)
(actions/walk-straight-to entities :ego [35 45] :anim :squat :override-dir :right :speed 3.0)
(actions/do-dialogue entities :ego "Ouch!"
:blergh "My turn.")
(actions/play-animation entities :ego :shock :stop? false)
(actions/play-animation entities :ego :burnt :stop? false)
(actions/play-animation entities :ego :passed-out :continue? true)
#_(common/go-to-jail entities)
(common/go-to-jail entities)
#_(actions/do-dialogue entities :ego "Hey!"
:ego "What's going on? I was just about to teach Blergh a lesson!"))
:magic-slingshot (actions/get-script entities
@@ -189,7 +188,7 @@
:x 222 :y 172 :baseline 240)
:collision "space/collision.png"
:scale-fn (constantly 1.5)
:start-pos [140 55]
:start-pos [35 45]
:apply-state (fn [e]
(as-> e e
(if (get-in e [:state :broke-jewel?])

View File

@@ -184,6 +184,9 @@
crowbar (utils/make-anim "ego/crowbar.png" [36 36] 0.1 [0 0 0 1 1 2 2 2 2 2 3 2 3 2 3 2 3 2 3 3 3 1 1 0 0 0])
shoot (utils/make-anim "ego/shoot.png" [24 36] 0.075 [0 0 0 1 1 2 2 2 2 2 2 2 2 3 4 5 4])
pant (utils/make-anim "ego/pant.png" [31 36] 0.5 [0 1])
shock (utils/make-anim "ego/shock.png" [40 48] 0.075 (flatten (repeat 2 [(repeat 5 [0 1 2]) (repeat 5 [3 4 5]) (repeat 5 [6 7 8])])))
burnt (utils/make-anim "ego/burnt.png" [40 46] 0.12 [1 2 3 2 1 2 3 2 1 0 2 0 4 5 6 7 8 9 10 11 10 9 10 11])
passed-out (utils/make-anim "ego/burnt.png" [40 46] 0.12 [9 10 11 10])
ego {:right {:walk walk-right
:stand stand-anim
@@ -211,7 +214,10 @@
[:fire 2] fire-2-anim
[:fire 3] fire-3-anim
:spear spear
:pant pant}
:pant pant
:shock shock
:burnt burnt
:passed-out passed-out}
:left {:walk (utils/flip walk-right)
:stand (utils/flip stand-anim)
:talk (utils/flip talk-anim)
@@ -238,7 +244,7 @@
:pant (utils/flip pant)}
:baseline (- 240 (last start-pos))
:facing :right
:origin-x 9
:origin-x 9
:origin-y 0
:scaled true
:step-sound (sound "ego/step.ogg")
@@ -293,7 +299,9 @@
ego (assoc ego :anim-sound-frames {(get-in ego [:left :walk]) {2 :step-sound
6 :step-sound}
(get-in ego [:right :walk]) {2 :step-sound
6 :step-sound}})]
6 :step-sound}}
:anim-merges {(get-in ego [:right :shock]) {:origin-x 15}
:default {:origin-x 9}})]
(actions/start-animation screen
(merge (animation->texture screen (:stand (:right ego))) ego)
:stand)))
@@ -338,7 +346,9 @@
(merge entity (animation->texture (update-in screen [:total-time] #(- % (:anim-start entity)))
(:anim entity))
{:current-frame-index (texture! (:anim entity) :get-key-frame-index (get-animation-point (:anim entity) (- (:total-time screen) (:anim-start entity))))
:previous-frame-index (texture! (:anim entity) :get-key-frame-index (get-animation-point (:anim entity) (- (:total-time screen) (:anim-start entity) (or (:delta-time screen) 0))))}))
:previous-frame-index (texture! (:anim entity) :get-key-frame-index (get-animation-point (:anim entity) (- (:total-time screen) (:anim-start entity) (or (:delta-time screen) 0))))}
(or (get-in entity [:anim-merges (:anim entity)])
(get-in entity [:anim-merges :default]))))
(defn get-layers [entities]