battle pacing works.

This commit is contained in:
Bryce Covert
2018-01-11 22:51:25 -08:00
parent 3ac732b172
commit dc35617281
15 changed files with 167 additions and 91 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,254 +1,310 @@
tongue-fight.png
size: 512,256
size: 1024,512
format: RGBA8888
filter: Nearest,Nearest
repeat: none
background
rotate: false
xy: 2, 14
xy: 2, 270
size: 320, 240
orig: 320, 240
offset: 0, 0
index: -1
hair-0
rotate: false
xy: 442, 160
xy: 735, 366
size: 7, 8
orig: 7, 8
offset: 0, 0
index: 0
hair-0
rotate: false
xy: 467, 178
xy: 839, 404
size: 7, 8
orig: 7, 8
offset: 0, 0
index: 1
hair-0
rotate: false
xy: 372, 24
xy: 853, 434
size: 7, 8
orig: 7, 8
offset: 0, 0
index: 2
hair-0
rotate: false
xy: 428, 128
xy: 888, 472
size: 7, 8
orig: 7, 8
offset: 0, 0
index: 3
hair-0
rotate: false
xy: 477, 196
xy: 902, 502
size: 7, 8
orig: 7, 8
offset: 0, 0
index: 4
hair-1
rotate: false
xy: 442, 170
xy: 276, 226
size: 23, 16
orig: 23, 16
offset: 0, 0
index: 0
hair-1
rotate: false
xy: 372, 34
xy: 2, 11
size: 23, 16
orig: 23, 16
offset: 0, 0
index: 1
hair-1
rotate: false
xy: 397, 34
xy: 51, 79
size: 23, 16
orig: 23, 16
offset: 0, 0
index: 2
hair-2
rotate: false
xy: 324, 52
xy: 2, 55
size: 47, 66
orig: 47, 66
offset: 0, 0
index: 0
hair-2
rotate: false
xy: 428, 188
xy: 324, 297
size: 47, 66
orig: 47, 66
offset: 0, 0
index: 1
hair-2
rotate: false
xy: 373, 52
xy: 839, 444
size: 47, 66
orig: 47, 66
offset: 0, 0
index: 2
hair-3
rotate: false
xy: 491, 226
xy: 276, 216
size: 7, 8
orig: 7, 8
offset: 0, 0
index: 0
hair-3
rotate: false
xy: 32, 4
xy: 51, 69
size: 7, 8
orig: 7, 8
offset: 0, 0
index: 1
hair-3
rotate: false
xy: 442, 150
xy: 42, 45
size: 7, 8
orig: 7, 8
offset: 0, 0
index: 2
hair-4
rotate: false
xy: 428, 158
xy: 373, 335
size: 12, 28
orig: 12, 28
offset: 0, 0
index: 0
hair-4
rotate: false
xy: 477, 226
xy: 839, 414
size: 12, 28
orig: 12, 28
offset: 0, 0
index: 1
hair-4
rotate: false
xy: 358, 22
xy: 888, 482
size: 12, 28
orig: 12, 28
offset: 0, 0
index: 2
hair-5
rotate: false
xy: 350, 285
size: 8, 10
orig: 8, 10
offset: 0, 0
index: 0
hair-5
rotate: false
xy: 373, 323
size: 8, 10
orig: 8, 10
offset: 0, 0
index: 1
hair-5
rotate: false
xy: 387, 353
size: 8, 10
orig: 8, 10
offset: 0, 0
index: 2
hair-6
rotate: false
xy: 350, 277
size: 4, 6
orig: 4, 6
offset: 0, 0
index: 0
hair-6
rotate: false
xy: 360, 289
size: 4, 6
orig: 4, 6
offset: 0, 0
index: 1
hair-6
rotate: false
xy: 373, 315
size: 4, 6
orig: 4, 6
offset: 0, 0
index: 2
hair-7
rotate: false
xy: 2, 2
size: 8, 10
orig: 8, 10
offset: 0, 0
index: 0
hair-5
rotate: false
xy: 12, 2
size: 8, 10
orig: 8, 10
offset: 0, 0
index: 1
hair-5
rotate: false
xy: 22, 2
size: 8, 10
orig: 8, 10
offset: 0, 0
index: 2
hair-6
rotate: false
xy: 422, 112
size: 4, 6
orig: 4, 6
offset: 0, 0
index: 0
hair-6
rotate: false
xy: 428, 120
size: 4, 6
orig: 4, 6
offset: 0, 0
index: 1
hair-6
rotate: false
xy: 477, 188
size: 4, 6
orig: 4, 6
offset: 0, 0
index: 2
hair-7
rotate: false
xy: 505, 247
size: 5, 7
orig: 5, 7
offset: 0, 0
index: 0
hair-7
rotate: false
xy: 505, 238
xy: 9, 2
size: 5, 7
orig: 5, 7
offset: 0, 0
index: 1
hair-7
rotate: false
xy: 505, 229
xy: 16, 2
size: 5, 7
orig: 5, 7
offset: 0, 0
index: 2
hair-8
rotate: false
xy: 451, 162
xy: 316, 262
size: 6, 6
orig: 6, 6
offset: 0, 0
index: 0
hair-8
rotate: false
xy: 467, 170
xy: 324, 263
size: 6, 6
orig: 6, 6
offset: 0, 0
index: 1
hair-8
rotate: false
xy: 381, 26
xy: 91, 115
size: 6, 6
orig: 6, 6
offset: 0, 0
index: 2
hair-9
rotate: false
xy: 428, 138
xy: 302, 250
size: 12, 18
orig: 12, 18
offset: 0, 0
index: 0
hair-9
rotate: false
xy: 477, 206
xy: 28, 35
size: 12, 18
orig: 12, 18
offset: 0, 0
index: 1
hair-9
rotate: false
xy: 491, 236
xy: 77, 103
size: 12, 18
orig: 12, 18
offset: 0, 0
index: 2
heart
rotate: false
xy: 324, 18
size: 32, 32
orig: 32, 32
xy: 276, 244
size: 24, 24
orig: 24, 24
offset: 0, 0
index: 0
heart
rotate: false
xy: 2, 29
size: 24, 24
orig: 24, 24
offset: 0, 0
index: 1
heart
rotate: false
xy: 51, 97
size: 24, 24
orig: 24, 24
offset: 0, 0
index: 2
heart
rotate: false
xy: 324, 271
size: 24, 24
orig: 24, 24
offset: 0, 0
index: 3
tongue-attack
rotate: false
xy: 2, 123
size: 135, 145
orig: 135, 145
offset: 0, 0
index: 0
tongue-attack
rotate: false
xy: 324, 365
size: 135, 145
orig: 135, 145
offset: 0, 0
index: 1
tongue-attack
rotate: false
xy: 139, 123
size: 135, 145
orig: 135, 145
offset: 0, 0
index: 2
tongue-idle
rotate: false
xy: 324, 120
xy: 735, 376
size: 102, 134
orig: 102, 134
offset: 0, 0
index: 0
tongue-windup
rotate: false
xy: 461, 365
size: 135, 145
orig: 135, 145
offset: 0, 0
index: 0
tongue-windup
rotate: false
xy: 598, 365
size: 135, 145
orig: 135, 145
offset: 0, 0
index: 1
tongue-fight2.png
size: 1024,256

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -29,8 +29,9 @@
[146 185])]
(-> entities
(update-in [:room :entities :heart] #(assoc % :opacity 1 :x x :y y))
(assoc-in [:tweens :heart-y] (tween/tween :heart-y screen [:room :entities :heart :y] y (+ y 10) 0.5 :ease tween/ease-out-cubic))
(assoc-in [:tweens :heart-opacity] (tween/tween :heart-opacity screen [:room :entities :heart :opacity] 1.0 0.0 0.5 :ease tween/ease-in-cubic))
(update-in [:room :entities :heart] #(actions/start-animation screen % :beat))
(assoc-in [:tweens :heart-y] (tween/tween :heart-y screen [:room :entities :heart :y] y (+ y 10) 1.0 :ease tween/ease-out-cubic))
(assoc-in [:tweens :heart-opacity] (tween/tween :heart-opacity screen [:room :entities :heart :opacity] 1.0 0.0 3.0 :ease tween/ease-in-out-quadratic))
(cause-damage is-player-wound?))))
(defn stop-swing-if-necessary [screen {{{{:keys [anim anim-start] {:keys [tongue-swing]} :left } :ego} :entities} :room :as entities}]
@@ -41,13 +42,20 @@
(update-in entities [:room :entities :ego] #(actions/start-animation screen % :tongue-idle))
entities))
(defn trigger-tongue [screen {{{
{:keys [state started anim anim-start]} :tongue
{ego-anim :anim {ego-windup :tongue-windup} :left } :ego
(defn trigger-tongue [screen {{{{:keys [state started anim anim-start]} :tongue
{ego-anim :anim ego-anim-start :anim-start {ego-windup :tongue-windup} :left } :ego
} :entities
:keys [ego-hearts tongue-hearts]} :room
:as entities}]
(let [time-in-state (- (:total-time screen) (or started (:total-time screen)))
tongue-finished? (animation! anim
:is-animation-finished
(- (:total-time screen) anim-start))
ego-finished? (animation! ego-anim
:is-animation-finished
(- (:total-time screen) ego-anim-start))
is-player-wound? (= ego-anim ego-windup)
entities (stop-swing-if-necessary screen entities)]
(cond
@@ -73,18 +81,18 @@
(and
(= state :attack)
(animation! anim
:is-animation-finished
(- (:total-time screen) anim-start)))
tongue-finished?)
(-> entities
(update-in [:room :entities :tongue] #(actions/start-animation screen % :idle))
(update-in [:room :entities :tongue] assoc :state :idle :started (:total-time screen)))
(update-in [:room :entities :tongue] assoc :state :idle :started (:total-time screen))
(update-in [:room :entities :heart] #(actions/start-animation screen % :idle)))
(and
(= state :windup)
(animation! anim
:is-animation-finished
(- (:total-time screen) anim-start)))
tongue-finished?
(or (not is-player-wound?)
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))
@@ -93,14 +101,19 @@
%))
(show-heart screen is-player-wound?))
(and (= state :idle)
is-player-wound?
ego-finished?)
(update-in entities [:room :entities :ego] #(actions/start-animation screen % :tongue-swing))
;; reset timer if you wind up while the tongue is idle
(and (= state :idle)
is-player-wound?)
(assoc-in entities [:room :entities :tongue :started] (:total-time screen))
(and (= state :idle)
(= 1 (rand-int (* 60 3)))
(> time-in-state 3.0)
(= 1 (rand-int (* 60 2)))
(> time-in-state 2.0)
(not is-player-wound?))
(-> entities
(update-in [:room :entities :tongue] #(actions/start-animation screen % :windup))
@@ -124,10 +137,11 @@
hair-7 (utils/make-anim-seq atlas "hair-7" [5 7] 0.16 [0 1 2 1])
hair-8 (utils/make-anim-seq atlas "hair-8" [6 6] 0.16 [0 1 2 1])
hair-9 (utils/make-anim-seq atlas "hair-9" [12 18] 0.16 [0 1 2 1])
heart (utils/make-anim-seq atlas "heart" [32 32] 0.16 [0])
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-idle/tongue-idle" [135 145] 0.16 [0 0 0 0 0])
tongue-attack (utils/make-anim-seq atlas "tongue-idle/tongue-idle" [135 145] 0.16 [1 1 1 1])]
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])]
(rooms/make :name "Tongue Fight"
@@ -226,6 +240,8 @@
:baseline 320
:opacity 0
:anim heart
:idle heart
:beat beat
:anim-start 0)
:tongue (assoc (animation->texture screen tongue-idle)
:x 186
@@ -239,11 +255,15 @@
:windup tongue-windup
:idle tongue-idle
:attack tongue-attack
: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}
}
:anim-start 0
:state :idle
:script (actions/get-script
entities
(actions/play-animation entities :ego :tongue-windup)))}
(actions/begin-animation entities :ego :tongue-windup)))}
:collision "space/collision.png"
:scale-fn (constantly 1.0)