summaryrefslogtreecommitdiff
path: root/game.scm
diff options
context:
space:
mode:
Diffstat (limited to 'game.scm')
-rw-r--r--game.scm54
1 files changed, 50 insertions, 4 deletions
diff --git a/game.scm b/game.scm
index 1c857b0..6820fc8 100644
--- a/game.scm
+++ b/game.scm
@@ -728,6 +728,9 @@
(match type
('turret (spawn-turret x y))
('popcorn (spawn-popcorn x y))
+ ('popcorn-swarm (spawn-popcorn-swarm x y))
+ ('popcorn-sweep-left (spawn-popcorn-sweep-left x y))
+ ('popcorn-sweep-right (spawn-popcorn-sweep-right x y))
('flyer0 (spawn-flyer0 x y))
('flyer1 (spawn-flyer1 x y))
('boss (spawn-boss x y))
@@ -987,6 +990,47 @@
(define (spawn-popcorn x y)
(spawn-popcorn* x y #f))
+ (define (spawn-popcorn-swarm x y)
+ (define (script popcorn)
+ (forever
+ (tween (lambda (dx)
+ (set-enemy-dx! popcorn dx))
+ 60 -0.5 0.5
+ smoothstep lerp)
+ (tween (lambda (dx)
+ (set-enemy-dx! popcorn dx))
+ 60 0.5 -0.5
+ smoothstep lerp)))
+ (spawn-popcorn* x y script))
+
+ (define (spawn-popcorn-sweep-left x y)
+ (define (script popcorn)
+ (set-enemy-dy! popcorn 1.0)
+ (tween (lambda (dx)
+ (set-enemy-dx! popcorn dx))
+ 60 0.0 -3.0
+ smoothstep lerp))
+ (run-script
+ (lambda ()
+ (do ((i 0 (+ i 1)))
+ ((= i 9))
+ (spawn-popcorn* x y script)
+ (wait 15)))))
+
+ (define (spawn-popcorn-sweep-right x y)
+ (define (script popcorn)
+ (set-enemy-dy! popcorn 1.0)
+ (tween (lambda (dx)
+ (set-enemy-dx! popcorn dx))
+ 60 0.0 3.0
+ smoothstep lerp))
+ (run-script
+ (lambda ()
+ (do ((i 0 (+ i 1)))
+ ((= i 9))
+ (spawn-popcorn* x y script)
+ (wait 15)))))
+
(define (spawn-flyer0 x y)
(define (script flyer)
(run-script
@@ -1462,11 +1506,11 @@
(set! *game-state* 'play)
(scheduler-reset! *scheduler*)
(set! *scroll* 0.0)
- ;; (set! *scroll* (* 345.0 tile-height))
+ ;; (set! *scroll* (* 335.0 tile-height))
(set! *last-scroll* 0.0)
(set! *last-row-scanned* (level-height level))
;; (set! *last-row-scanned* (- (level-height level)
- ;; 345))
+ ;; 335))
(bullet-pool-reset! player-bullets)
(bullet-pool-reset! enemy-bullets)
(enemy-pool-reset! enemies)
@@ -1566,7 +1610,8 @@
(define (out-of-bounds? x y w h)
(let ((padding 32.0))
(not (rect-within? x y w h (- padding) (- padding)
- (+ game-width padding) (+ game-height padding)))))
+ (+ game-width (* padding 2.0))
+ (+ game-height (* padding 2.0))))))
(define (player-bullet-collide type x y w h)
(let ((x* (- x (/ w 2.0)))
@@ -1603,9 +1648,9 @@
(define dt (/ 1000.0 60.0))
(define (update)
- (scheduler-tick! *scheduler*)
(match *game-state*
('play
+ (scheduler-tick! *scheduler*)
(level-update! level)
(player-update!)
(bullet-pool-update! player-bullets player-bullet-collide)
@@ -1622,6 +1667,7 @@
(particle-pool-update! particles)
(enemy-pool-update! enemies))
('game-clear
+ (scheduler-tick! *scheduler*)
(bullet-pool-update! player-bullets player-bullet-collide)
(bullet-pool-update! enemy-bullets enemy-bullet-collide)
(particle-pool-update! particles))