summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game.scm13
1 files changed, 12 insertions, 1 deletions
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)