diff options
-rw-r--r-- | game.scm | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -436,6 +436,7 @@ (let loop ((i 0) (k length)) (when (< i k) (let* ((offset (bullet-pool-offset i)) + (type (s32-ref bullets offset)) (x (f64-ref bullets (+ offset 12))) (y (f64-ref bullets (+ offset 20))) (w (f64-ref bullets (+ offset 28))) @@ -445,7 +446,7 @@ (x* (+ x dx)) (y* (+ y dy))) (cond - ((collide x* y* w h) + ((collide type x* y* w h) (bullet-pool-remove! pool i) (loop i (- k 1))) (else @@ -497,7 +498,7 @@ (objects level-objects set-level-objects!)) (define level ,(call-with-input-file "level.scm" read)) (define (level-offset x y) - (* (+ (* level-width y) x))) + (+ (* level-width y) x)) (define (point-collides-with-level? level x y) (match level (#('level height foreground background collision objects) @@ -770,7 +771,7 @@ (define player-height 24.0) (define *player-fire-counter* 0) (define player-fire-interval 3) - (define player-focus-fire-interval 2) + (define player-focus-fire-interval 5) (define player-hitbox-position (vec2 0.0 0.0)) (define player-hitbox-width 2.0) (define player-hitbox-height 2.0) @@ -1078,7 +1079,7 @@ (not (rect-within? x y w h (- padding) (- padding) (+ game-width padding) (+ game-height padding))))) - (define (player-bullet-collide x y w h) + (define (player-bullet-collide type x y w h) (let ((x* (- x (/ w 2.0))) (y* (- y(/ h 2.0)))) (or (out-of-bounds? x* y* w h) @@ -1086,10 +1087,13 @@ (let ((enemy (find-enemy enemies x y w h))) (and enemy (begin - (enemy-damage! enemy 1) + (enemy-damage! enemy + (case type + ((0) 1) + ((1) 3))) #t)))))) - (define (enemy-bullet-collide x y w h) + (define (enemy-bullet-collide type x y w h) (let ((x* (- x (/ w 2.0))) (y* (- y(/ h 2.0)))) (or (out-of-bounds? x* y* w h) |