working on fight.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
[play-clj.g2d :refer :all]))
|
||||
(println "loading " *ns*)
|
||||
|
||||
|
||||
(defn cause-damage [entities is-player-wound?]
|
||||
(if is-player-wound?
|
||||
(update-in entities [:room :ego-hearts] dec)
|
||||
@@ -84,6 +85,7 @@
|
||||
tongue-finished?)
|
||||
(-> entities
|
||||
(update-in [:room :entities :tongue] #(actions/start-animation screen % :idle))
|
||||
(update-in [:room :entities :ego] #(actions/start-animation screen % :tongue-idle))
|
||||
(update-in [:room :entities :tongue] assoc :state :idle :started (:total-time screen))
|
||||
(update-in [:room :entities :heart] #(actions/start-animation screen % :idle)))
|
||||
|
||||
@@ -94,11 +96,13 @@
|
||||
ego-finished?))
|
||||
|
||||
(-> entities
|
||||
(update-in [:room :entities :tongue] #(actions/start-animation screen % :attack))
|
||||
(update-in [:room :entities :tongue] assoc :state :attack :started (:total-time screen))
|
||||
(update-in [:room :entities :tongue] #(if is-player-wound?
|
||||
(actions/start-animation screen % :attack-hit)
|
||||
(actions/start-animation screen % :attack)))
|
||||
(update-in [:room :entities :tongue] assoc :state :attack :started (:total-time screen) )
|
||||
(update-in [:room :entities :ego] #(if is-player-wound?
|
||||
(actions/start-animation screen % :tongue-swing)
|
||||
%))
|
||||
(actions/start-animation screen % :tongue-hit)))
|
||||
(show-heart screen is-player-wound?))
|
||||
|
||||
(and (= state :idle)
|
||||
@@ -140,8 +144,9 @@
|
||||
heart (utils/make-anim-seq atlas "heart" [24 24] 0.08 [3])
|
||||
beat (utils/make-anim-seq atlas "heart" [24 24] 0.08 [0 1 0 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3])
|
||||
tongue-idle (utils/make-anim-seq atlas "tongue-idle/tongue-idle" [135 145] 0.16 (range 5))
|
||||
tongue-windup (utils/make-anim-seq atlas "tongue-windup" [135 145] 0.16 [0 1 0 1 0 1 0 ])
|
||||
tongue-attack (utils/make-anim-seq atlas "tongue-attack" [135 145] 0.08 [0 1 2 2 2 2 2 2 2 2 2 2])]
|
||||
tongue-windup (utils/make-anim-seq atlas "tongue-windup" [135 145] 0.16 [0 1 2 3 2 1 2 3 2 1 0 ])
|
||||
tongue-attack (utils/make-anim-seq atlas "tongue-attack" [135 145] 0.08 [0 1 2 2 2 2 2 2 2 2 2 2])
|
||||
tongue-attack-hit (utils/make-anim-seq atlas "tongue-attack-hit" [135 145] 0.1 (range 7))]
|
||||
|
||||
|
||||
(rooms/make :name "Tongue Fight"
|
||||
@@ -244,21 +249,22 @@
|
||||
:beat beat
|
||||
:anim-start 0)
|
||||
:tongue (assoc (animation->texture screen tongue-idle)
|
||||
:x 186
|
||||
:y 65
|
||||
:x 211
|
||||
:y 40
|
||||
:origin-x 23
|
||||
:origin-y 10
|
||||
:width 135
|
||||
:height 145
|
||||
:baseline 2
|
||||
:baseline 4
|
||||
:anim tongue-idle
|
||||
:windup tongue-windup
|
||||
:idle tongue-idle
|
||||
:attack tongue-attack
|
||||
:attack-hit tongue-attack-hit
|
||||
:anim-merges {tongue-idle {:origin-x 23 :origin-y 10}
|
||||
tongue-windup {:origin-x 23 :origin-y 10}
|
||||
tongue-attack {:origin-x 119 :origin-y 10}
|
||||
}
|
||||
tongue-attack-hit {:origin-x 100 :origin-y 10}}
|
||||
:anim-start 0
|
||||
:state :idle
|
||||
:script (actions/get-script
|
||||
@@ -272,6 +278,7 @@
|
||||
(-> e
|
||||
(update-in [:room :entities :ego] #(actions/start-animation screen % :tongue-idle))
|
||||
(assoc-in [:room :entities :ego :stand-override] :tongue-idle)
|
||||
(assoc-in [:room :entities :ego :baseline] 3)
|
||||
(assoc-in [:room :entities :ego :x] 141)
|
||||
(assoc-in [:room :entities :ego :y] 110))))))
|
||||
|
||||
|
||||
@@ -519,8 +519,9 @@
|
||||
love (utils/make-anim-seq global-atlas "ego/love" [50 70] 0.1 (flatten [0 0 1 1 2 2 3 3 4 4 5 5 6 6 (repeat 10 7) (repeat 5 8) (repeat 5 7) (repeat 5 8) (repeat 5 7) (repeat 10 [23 24 25 24]) (repeat 30 9) 10 11 12 13 14 15 16 17 18 19 20 21 21 21 22 22 22 21 21 21 21 21 21 21 21 22 22 22 22 22 21 21 21 21 22 22 22 22 22 22 21 21 21 21 21 6 6 5 5 4 4 3 3 2 2 1 1 0]))
|
||||
whistle (utils/make-anim-seq global-atlas "ego/whistle" [18 36] 0.2 (flatten [0 1 1 (repeat 200 [2 3])]))
|
||||
axe (utils/make-anim global-atlas "ego/axe" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 7)]))
|
||||
tongue-windup (utils/make-anim-seq global-atlas "ego/tongue-stance" [119 134] 0.05 [0 1 2 2 2 2 2 2 2 2])
|
||||
tongue-windup (utils/make-anim-seq global-atlas "ego/tongue-stance" [119 134] 0.05 [0 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2])
|
||||
tongue-swing (utils/make-anim-seq global-atlas "ego/tongue-stance" [119 134] 0.12 [ 3 4 5 6 ])
|
||||
tongue-hit (utils/make-anim-seq global-atlas "ego/tongue-hit" [119 134] 0.12 [0 1 2 2 2 2 3])
|
||||
tongue-idle (utils/make-anim-seq global-atlas "ego/tongue-idle" [119 134] 0.7 [0 1])
|
||||
axe-wood (utils/make-anim global-atlas "ego/axe-wood" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 11)]))
|
||||
suspended (utils/make-anim global-atlas "ego/suspended" [20 36] 0.10 [0])
|
||||
@@ -561,6 +562,7 @@
|
||||
:reach-start reach-start
|
||||
:jump jump
|
||||
:tongue-swing tongue-swing
|
||||
:tongue-hit tongue-hit
|
||||
:tongue-windup tongue-windup
|
||||
:tongue-idle tongue-idle
|
||||
:jump-straight jump-straight
|
||||
@@ -623,6 +625,7 @@
|
||||
:reach-start (utils/flip reach-start)
|
||||
:jump-straight (utils/flip jump-straight)
|
||||
:tongue-swing tongue-swing
|
||||
:tongue-hit tongue-hit
|
||||
:tongue-windup tongue-windup
|
||||
:tongue-idle tongue-idle
|
||||
:jumping-straight (utils/flip jumping-straight)
|
||||
@@ -750,6 +753,7 @@
|
||||
(get-in ego [:left :jump-straight]) {:origin-x 9}
|
||||
(get-in ego [:right :jump-straight]) {:origin-x 9}
|
||||
(get-in ego [:left :tongue-swing]) {:origin-x 41 :origin-y 15}
|
||||
(get-in ego [:left :tongue-hit]) {:origin-x 41 :origin-y 15}
|
||||
(get-in ego [:left :tongue-windup]) {:origin-x 41 :origin-y 15}
|
||||
(get-in ego [:left :tongue-idle]) {:origin-x 41 :origin-y 15}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user