summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2023-10-28 11:48:47 -0400
committerDavid Thompson <dthompson2@worcester.edu>2023-10-28 11:48:47 -0400
commit70b79936887c5c4a2549ce3f3f8962917cc5f10e (patch)
treea6829a1f84c3f84b61f69d7d53abb33b9db88eb8
parent58dfdd5c9a4285e55cc17e803f9924077e927dfe (diff)
Scriptable scroll speed!
-rw-r--r--compile-map.scm4
-rw-r--r--game.scm116
-rw-r--r--level.tmx400
-rw-r--r--todo.org34
4 files changed, 425 insertions, 129 deletions
diff --git a/compile-map.scm b/compile-map.scm
index 1270fc4..486145f 100644
--- a/compile-map.scm
+++ b/compile-map.scm
@@ -543,12 +543,14 @@ the default ORIENTATION value of 'orthogonal' is supported."
(th (tile-map-tile-height tile-map)))
(for-each (lambda (obj)
(let* ((type (map-object-type obj))
+ (properties (map-object-properties obj))
(r (map-object-shape obj))
(x (/ (rect-x r) tw))
(y (/ (rect-y r) th)))
;; (format (current-error-port) "obj: ~a ~a ~a ~a\n" (rect-x r) (rect-y r) x y)
(hashv-set! table y
- (cons `(make-level-object ,x (quote ,type))
+ (cons `(make-level-object ,x (quote ,type)
+ (quote ,properties))
(hashv-ref table y '())))))
(object-layer-objects layer))
`(vector
diff --git a/game.scm b/game.scm
index aa478ab..c9592c0 100644
--- a/game.scm
+++ b/game.scm
@@ -215,6 +215,18 @@
((> x max) max)
(else x)))
+ (define (smoothstep t)
+ (* t t (- 3.0 (* 2.0 t))))
+
+ (define (lerp start end alpha)
+ (+ (* start (- 1.0 alpha))
+ (* end alpha)))
+
+ (define (assq-ref lst key)
+ (match (assq key lst)
+ (#f #f)
+ ((_ . val) val)))
+
(define-type vec2
make-vec2
vec2?
@@ -325,6 +337,8 @@
(define sound:enemy-shoot (load-sound-effect "audio/enemy-shoot.wav"))
(define sound:bullet-hit (load-sound-effect "audio/bullet-hit.wav"))
+ (define *debug?* #f)
+
;; Scripting
(define (make-scheduler max-tasks)
(vector 0 0 max-tasks (make-vector max-tasks)))
@@ -417,6 +431,14 @@
(let loop ()
body ...
(loop)))
+ (define* (tween proc duration start end ease interpolate)
+ (let loop ((t 0))
+ (if (= t duration)
+ (proc end)
+ (let ((alpha (ease (/ t duration))))
+ (proc (interpolate start end alpha))
+ (wait 1)
+ (loop (+ t 1))))))
;; Particles:
(define-type particle-pool
@@ -611,6 +633,12 @@
(define *scroll* 0.0)
(define *last-scroll* 0.0)
(define *scroll-speed* 0.5)
+ (define (change-scroll-speed new-speed duration)
+ (tween (lambda (speed)
+ (set! *scroll-speed* speed))
+ duration
+ *scroll-speed* new-speed
+ smoothstep lerp))
(define *last-row-scanned* 0)
;; action id, sprite sheet offset, x, y
(define %tile-size (+ 4 8 8 8))
@@ -621,7 +649,8 @@
make-level-object
level-object?
(x level-object-x set-level-object-x!)
- (type level-object-type set-level-object-type!))
+ (type level-object-type set-level-object-type!)
+ (properties level-object-properties set-level-object-properties!))
(define-type level
make-level
level?
@@ -683,6 +712,19 @@
(match level
(#('level height foreground collision objects)
(draw-level-layer level foreground 1.0))))
+ (define (do-level-action type x y properties)
+ (match type
+ ('turret (spawn-turret x y))
+ ('popcorn (spawn-popcorn x y))
+ ('flyer0 (spawn-flyer0 x y))
+ ('flyer1 (spawn-flyer1 x y))
+ ('boss (spawn-boss x y))
+ ('scroll-speed
+ (let ((speed (assq-ref properties 'speed))
+ (ticks (or (assq-ref properties 'ticks) 0)))
+ (when speed
+ (change-scroll-speed speed ticks))))
+ (_ #t)))
(define max-scroll (- (* (level-height level) tile-height) game-height))
(define (level-update! level)
(match level
@@ -699,18 +741,12 @@
((= y *last-row-scanned*))
(for-each (lambda (obj)
(match obj
- (#('level-object x type)
+ (#('level-object x type properties)
(let ((x* (+ (* x tile-width)
(/ tile-width 2.0)))
(y* (+ (* (- y row 3) tile-height)
(/ tile-height 2.0))))
- (match type
- ('turret (spawn-turret x* y*))
- ('popcorn (spawn-popcorn x* y*))
- ('flyer0 (spawn-flyer0 x* y*))
- ('flyer1 (spawn-flyer1 x* y*))
- ('boss (spawn-boss x* y*))
- (_ #t))))))
+ (do-level-action type x* y* properties)))))
(vector-ref objects y)))
(set! *last-row-scanned* row))))))
@@ -722,7 +758,6 @@
(health enemy-health set-enemy-health!)
(position enemy-position set-enemy-position!)
(size enemy-size set-enemy-size!)
- (stationary? enemy-stationary? set-enemy-stationary!)
(velocity enemy-velocity set-enemy-velocity!)
(script enemy-script set-enemy-script!)
(points enemy-points set-enemy-points!)
@@ -730,9 +765,9 @@
(animation enemy-animation set-enemy-animation!)
(image enemy-image set-enemy-image!)
(image-size enemy-image-size set-enemy-image-size!))
- (define (make-enemy type health position size stationary? velocity
+ (define (make-enemy type health position size velocity
script points animation image image-size)
- (%make-enemy type health position size stationary? velocity script
+ (%make-enemy type health position size velocity script
points (inexact (current-jiffy)) animation image
image-size))
(define (enemy-x enemy)
@@ -753,18 +788,18 @@
(set-vec2-y! (enemy-velocity enemy) dy))
(define (enemy-damage! enemy damage)
(match enemy
- (#('enemy type health _ _ _ _ _ _ _ _ _ _)
+ (#('enemy type health _ _ _ _ _ _ _ _ _)
(set-enemy-health! enemy (- health damage)))))
(define (enemy-dead? enemy)
(<= (enemy-health enemy) 0))
(define (enemy-out-of-bounds? enemy)
(match enemy
- (#('enemy _ _ position size _ _ _ _ _ _ _ _)
+ (#('enemy _ _ position size _ _ _ _ _ _ _)
(out-of-bounds? (vec2-x position) (vec2-y position)
(vec2-x size) (vec2-y size)))))
(define (enemy-within-rect? enemy x y w h)
(match enemy
- (#('enemy _ _ position size _ _ _ _ _ _ _ _)
+ (#('enemy _ _ position size _ _ _ _ _ _ _)
(let* ((w* (vec2-x size))
(h* (vec2-y size))
(x* (- (vec2-x position) (/ w* 2.0)))
@@ -780,18 +815,15 @@
(script-cancel! script))))
(define (enemy-update! enemy)
(match enemy
- (#('enemy _ _ position size stationary? velocity _ _ _ _ _ _)
+ (#('enemy _ _ position size velocity _ _ _ _ _ _)
(let ((scroll-dy (- *scroll* *last-scroll*)))
- (if stationary?
- (set-vec2-y! position (+ (vec2-y position) scroll-dy))
- (begin
- (set-vec2-x! position (+ (vec2-x position) (vec2-x velocity)))
- (set-vec2-y! position (+ (vec2-y position)
- (+ (vec2-y velocity) scroll-dy)))))))))
+ (set-vec2-x! position (+ (vec2-x position) (vec2-x velocity)))
+ (set-vec2-y! position (+ (vec2-y position)
+ (+ (vec2-y velocity) scroll-dy)))))))
(define (draw-enemy enemy time)
(let ((frame-duration 250.0))
(match enemy
- (#('enemy type _ position size _ _ _ _ spawn-time animation
+ (#('enemy type _ position size _ _ _ spawn-time animation
image image-size)
(let* ((tx (vector-ref animation
(modulo (truncate
@@ -806,12 +838,12 @@
(h (vec2-y image-size)))
(draw-image context image tx 0.0 w h
(- x (/ w 2.0)) (- y (/ h 2.0)) w h)
- ;; (set-fill-color! context "#ff00ff80")
- ;; (fill-rect context
- ;; (- x (/ hbw 2.0))
- ;; (- y (/ hbh 2.0))
- ;; hbw hbh)
- )))))
+ (when *debug?*
+ (set-fill-color! context "#ff00ff80")
+ (fill-rect context
+ (- x (/ hbw 2.0))
+ (- y (/ hbh 2.0))
+ hbw hbh)))))))
(define-type enemy-pool
%make-enemy-pool
@@ -894,25 +926,25 @@
(define (spawn-turret* x y script)
(spawn-enemy
(make-enemy 'turret 10 (vec2 x y) (vec2 12.0 12.0)
- #t (vec2 0.0 0.0) script 100
+ (vec2 0.0 0.0) script 100
#(0.0 0.0 0.0 0.0) image:turret (vec2 32.0 32.0))))
(define (spawn-popcorn* x y script)
(spawn-enemy
(make-enemy 'popcorn 1 (vec2 x y) (vec2 12.0 12.0)
- #t (vec2 0.0 0.0) script 100
+ (vec2 0.0 0.0) script 100
#(0.0 0.0 0.0 0.0) image:popcorn (vec2 32.0 32.0))))
(define (spawn-flyer0* x y script)
(spawn-enemy
(make-enemy 'flyer0 20 (vec2 x y) (vec2 12.0 12.0)
- #f (vec2 0.0 0.0) script 100
+ (vec2 0.0 0.0) script 100
#(0.0 0.0 0.0 0.0) image:flyer0 (vec2 32.0 32.0))))
(define (spawn-flyer1* x y script)
(spawn-enemy
(make-enemy 'flyer1 10 (vec2 x y) (vec2 16.0 16.0)
- #f (vec2 0.0 0.0) script 100
+ (vec2 0.0 0.0) script 100
#(0.0 0.0 0.0 0.0) image:flyer1 (vec2 32.0 32.0))))
(define (spawn-turret x y)
@@ -965,7 +997,7 @@
(define (spawn-boss x y)
(spawn-enemy
(make-enemy 'boss 300 (vec2 x y) (vec2 100.0 40.0)
- #t (vec2 0.0 0.0) #f 1000000
+ (vec2 0.0 0.0) #f 1000000
#(0.0 0.0 0.0 0.0) image:boss (vec2 120.0 80.0))))
;; Player state:
@@ -1122,12 +1154,13 @@
(- (vec2-y player-position)
(/ player-height 2.0))
player-width player-height)
- (set-fill-color! context "#ff00ff80")
- (fill-rect context
- (vec2-x player-hitbox-position)
- (vec2-y player-hitbox-position)
- player-hitbox-width
- player-hitbox-height))
+ (when *debug?*
+ (set-fill-color! context "#ff00ff80")
+ (fill-rect context
+ (vec2-x player-hitbox-position)
+ (vec2-y player-hitbox-position)
+ player-hitbox-width
+ player-hitbox-height)))
(define (direction-to-player v)
(let ((v* (vec2 (vec2-x player-position) (vec2-y player-position))))
(vec2-sub! v* v)
@@ -1284,6 +1317,9 @@
((string-=? code "Enter")
(set! *game-state* 'paused)
(prevent-default! event))
+ ((string-=? code "KeyD")
+ (set! *debug?* (not *debug?*))
+ (prevent-default! event))
((string-=? code "KeyR")
(reset!)
(prevent-default! event))
diff --git a/level.tmx b/level.tmx
index de0e093..49eefb6 100644
--- a/level.tmx
+++ b/level.tmx
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<map version="1.8" tiledversion="1.8.6" orientation="orthogonal" renderorder="right-down" width="15" height="80" tilewidth="16" tileheight="16" infinite="0" nextlayerid="8" nextobjectid="68">
+<map version="1.8" tiledversion="1.8.6" orientation="orthogonal" renderorder="right-down" width="15" height="200" tilewidth="16" tileheight="16" infinite="0" nextlayerid="8" nextobjectid="72">
<tileset firstgid="1" source="tiles.tsx"/>
<tileset firstgid="7" source="background.tsx"/>
<objectgroup id="7" name="background" visible="0" parallaxy="0.75">
- <object id="14" gid="7" x="0" y="960" width="240" height="320"/>
- <object id="15" gid="7" x="0" y="640" width="240" height="320"/>
- <object id="16" gid="7" x="0" y="320" width="240" height="320"/>
+ <object id="14" gid="7" x="0" y="2880" width="240" height="320"/>
+ <object id="15" gid="7" x="0" y="2560" width="240" height="320"/>
+ <object id="16" gid="7" x="0" y="2240" width="240" height="320"/>
</objectgroup>
- <layer id="1" name="foreground" width="15" height="80">
+ <layer id="1" name="foreground" width="15" height="200">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -29,6 +29,126 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,6,
-6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
-6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
-6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
-6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
-6,6,0,0,0,0,0,0,0,0,0,0,0,6,6,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -176,43 +416,55 @@
</data>
</layer>
<objectgroup id="3" name="objects">
- <object id="10" type="turret" x="16" y="656" width="16" height="16"/>
- <object id="11" type="turret" x="192" y="656" width="16" height="16"/>
- <object id="17" type="flyer0" x="96" y="320" width="16" height="16"/>
- <object id="19" type="popcorn" x="144" y="416" width="16" height="16"/>
- <object id="20" type="popcorn" x="144" y="448" width="16" height="16"/>
- <object id="21" type="popcorn" x="144" y="480" width="16" height="16"/>
- <object id="22" type="popcorn" x="128" y="512" width="16" height="16"/>
- <object id="23" type="popcorn" x="112" y="544" width="16" height="16"/>
- <object id="24" type="popcorn" x="112" y="576" width="16" height="16"/>
- <object id="25" type="popcorn" x="64" y="672" width="16" height="16"/>
- <object id="26" type="popcorn" x="96" y="672" width="16" height="16"/>
- <object id="27" type="popcorn" x="128" y="672" width="16" height="16"/>
- <object id="28" type="popcorn" x="160" y="672" width="16" height="16"/>
- <object id="29" type="popcorn" x="80" y="640" width="16" height="16"/>
- <object id="30" type="popcorn" x="112" y="640" width="16" height="16"/>
- <object id="31" type="popcorn" x="144" y="640" width="16" height="16"/>
- <object id="32" type="flyer0" x="128" y="320" width="16" height="16"/>
- <object id="33" type="flyer0" x="112" y="272" width="16" height="16"/>
- <object id="34" type="flyer0" x="96" y="224" width="16" height="16"/>
- <object id="35" type="flyer0" x="128" y="224" width="16" height="16"/>
- <object id="36" type="boss" x="112" y="48" width="16" height="16"/>
- <object id="39" type="flyer0" x="64" y="976" width="16" height="16"/>
- <object id="42" type="flyer0" x="160" y="976" width="16" height="16"/>
- <object id="53" type="popcorn" x="0" y="1040" width="16" height="16"/>
- <object id="54" type="popcorn" x="32" y="1040" width="16" height="16"/>
- <object id="55" type="popcorn" x="64" y="1040" width="16" height="16"/>
- <object id="56" type="popcorn" x="96" y="1040" width="16" height="16"/>
- <object id="57" type="popcorn" x="16" y="1008" width="16" height="16"/>
- <object id="58" type="popcorn" x="48" y="1008" width="16" height="16"/>
- <object id="59" type="popcorn" x="80" y="1008" width="16" height="16"/>
- <object id="60" type="popcorn" x="128" y="1040" width="16" height="16"/>
- <object id="61" type="popcorn" x="160" y="1040" width="16" height="16"/>
- <object id="62" type="popcorn" x="192" y="1040" width="16" height="16"/>
- <object id="63" type="popcorn" x="224" y="1040" width="16" height="16"/>
- <object id="64" type="popcorn" x="144" y="1008" width="16" height="16"/>
- <object id="65" type="popcorn" x="176" y="1008" width="16" height="16"/>
- <object id="66" type="popcorn" x="208" y="1008" width="16" height="16"/>
- <object id="67" type="popcorn" x="112" y="1008" width="16" height="16"/>
+ <object id="10" type="turret" x="16" y="2576" width="16" height="16"/>
+ <object id="11" type="turret" x="192" y="2576" width="16" height="16"/>
+ <object id="17" type="flyer0" x="96" y="2240" width="16" height="16"/>
+ <object id="19" type="popcorn" x="144" y="2336" width="16" height="16"/>
+ <object id="20" type="popcorn" x="144" y="2368" width="16" height="16"/>
+ <object id="21" type="popcorn" x="144" y="2400" width="16" height="16"/>
+ <object id="22" type="popcorn" x="128" y="2432" width="16" height="16"/>
+ <object id="23" type="popcorn" x="112" y="2464" width="16" height="16"/>
+ <object id="24" type="popcorn" x="112" y="2496" width="16" height="16"/>
+ <object id="25" type="popcorn" x="64" y="2592" width="16" height="16"/>
+ <object id="26" type="popcorn" x="96" y="2592" width="16" height="16"/>
+ <object id="27" type="popcorn" x="128" y="2592" width="16" height="16"/>
+ <object id="28" type="popcorn" x="160" y="2592" width="16" height="16"/>
+ <object id="29" type="popcorn" x="80" y="2560" width="16" height="16"/>
+ <object id="30" type="popcorn" x="112" y="2560" width="16" height="16"/>
+ <object id="31" type="popcorn" x="144" y="2560" width="16" height="16"/>
+ <object id="32" type="flyer0" x="128" y="2240" width="16" height="16"/>
+ <object id="33" type="flyer0" x="112" y="2192" width="16" height="16"/>
+ <object id="34" type="flyer0" x="96" y="2144" width="16" height="16"/>
+ <object id="35" type="flyer0" x="128" y="2144" width="16" height="16"/>
+ <object id="36" type="boss" x="112" y="1968" width="16" height="16"/>
+ <object id="39" type="flyer0" x="64" y="2896" width="16" height="16"/>
+ <object id="42" type="flyer0" x="160" y="2896" width="16" height="16"/>
+ <object id="53" type="popcorn" x="0" y="2960" width="16" height="16"/>
+ <object id="54" type="popcorn" x="32" y="2960" width="16" height="16"/>
+ <object id="55" type="popcorn" x="64" y="2960" width="16" height="16"/>
+ <object id="56" type="popcorn" x="96" y="2960" width="16" height="16"/>
+ <object id="57" type="popcorn" x="16" y="2928" width="16" height="16"/>
+ <object id="58" type="popcorn" x="48" y="2928" width="16" height="16"/>
+ <object id="59" type="popcorn" x="80" y="2928" width="16" height="16"/>
+ <object id="60" type="popcorn" x="128" y="2960" width="16" height="16"/>
+ <object id="61" type="popcorn" x="160" y="2960" width="16" height="16"/>
+ <object id="62" type="popcorn" x="192" y="2960" width="16" height="16"/>
+ <object id="63" type="popcorn" x="224" y="2960" width="16" height="16"/>
+ <object id="64" type="popcorn" x="144" y="2928" width="16" height="16"/>
+ <object id="65" type="popcorn" x="176" y="2928" width="16" height="16"/>
+ <object id="66" type="popcorn" x="208" y="2928" width="16" height="16"/>
+ <object id="67" type="popcorn" x="112" y="2928" width="16" height="16"/>
+ <object id="70" type="scroll-speed" x="0" y="1888" width="16" height="16">
+ <properties>
+ <property name="duration" type="int" value="30"/>
+ <property name="speed" type="float" value="0"/>
+ </properties>
+ </object>
+ <object id="71" type="scroll-speed" x="0" y="2672" width="16" height="16">
+ <properties>
+ <property name="duration" type="int" value="30"/>
+ <property name="speed" type="float" value="1"/>
+ </properties>
+ </object>
</objectgroup>
</map>
diff --git a/todo.org b/todo.org
index ba29d81..c72059b 100644
--- a/todo.org
+++ b/todo.org
@@ -9,28 +9,34 @@
* TODO parallax tile object backgrounds
* TODO player animation
* DONE enemy animation
+* DONE nested scripts
* TODO turret enemy
* TODO popcorn enemy
* TODO flying enemy 1
-* TODO flying enemy 2 (maybe)
+* TODO flying enemy 2
* TODO boss
* DONE scoring
* TODO design map
** phases
-- open, popcorn enemies
- - easy, player gets used to controls
-- wall on one side, turrets + popcorn
- - focus fire helps take down turrets faster
-- wide tunnel, flying enemies + popcorn
-- narrow tunnel, turrets shooting sideways
- - need to move up/down screen to avoid
-- open, flying enemies + popcorn
+- open space, just the player for the first screen of tiles
+- popcorn appear
+- turrets appear
+- flyers appear
+- enter tunnel, turrets + popcorn
+- waves of flyers sweep in
+- occasional chunks of tiles in the middle of tunnel to navigate around
+- scrolling slows, tunnel makes series of S turns, lots of turrets + some popcorn
+- tunnel narrows and straightens out, turrets on left/right shoot horizontally
+- turrets pressure player to move up/down screen to avoid, like ikaruga stage 3
+- tunnel widens, flyers + popcorn + turrets
- scroll speed increases
-- narrow tunnel + popcorn
- - quick left/right movement to avoid crashing
-- scrolling stops, top mounted turrets + flying enemies
-- scrolling resumes, popcorn
-- boss
+- tunnel narrows, quick left/right movement required to avoid crashing, popcorn clogs the tunnel
+- tunnel widens, scrolling slows then stops, turrets on top + waves of flying enemies sweep in
+- scrolling resumes, player exits tunnel into open space
+- final attack by larger flyers
+- empty screen, then WARNING text flashes
+- scrolling stops, boss appears
+- boss goes through 2-3 phases of bullet patterns as its health drops
* TODO music track
* DONE particles
* TODO juice!