From 62b9299417dede88889fd9e86d4619211d2bcc7a Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 22 Oct 2023 20:36:32 -0400 Subject: Player can be hit by enemy bullets. --- game.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/game.scm b/game.scm index 36f99d6..6f51d5a 100644 --- a/game.scm +++ b/game.scm @@ -696,7 +696,18 @@ (let ((x* (- x (/ w 2.0))) (y* (- y(/ h 2.0)))) (or (out-of-bounds? x* y* w h) - (rect-collides-with-level? level x* y* w h)))) + (rect-collides-with-level? level x* y* w h) + (if (rect-within? x y w h + (- (vec2-x player-position) + (/ player-hitbox-width 2.0)) + (- (vec2-y player-position) + (/ player-hitbox-height 2.0)) + player-hitbox-width + player-hitbox-height) + (begin + (player-die!) + #t) + #f)))) (define (enemy-collide x y w h hp) hp) -- cgit v1.2.3