diff options
author | David Thompson <dthompson2@worcester.edu> | 2023-10-22 20:36:32 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2023-10-22 20:36:32 -0400 |
commit | 62b9299417dede88889fd9e86d4619211d2bcc7a (patch) | |
tree | d7a3c30063879d3e5819f0a32143e5b1d90e99fd | |
parent | 07f7219be17097f08dac90a4d0f38f7c6e843722 (diff) |
Player can be hit by enemy bullets.
-rw-r--r-- | game.scm | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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) |