summaryrefslogtreecommitdiff
path: root/lisparuga/enemy.scm
diff options
context:
space:
mode:
Diffstat (limited to 'lisparuga/enemy.scm')
-rw-r--r--lisparuga/enemy.scm12
1 files changed, 6 insertions, 6 deletions
diff --git a/lisparuga/enemy.scm b/lisparuga/enemy.scm
index aa5335e..06533ea 100644
--- a/lisparuga/enemy.scm
+++ b/lisparuga/enemy.scm
@@ -49,6 +49,7 @@
;;;
(define-asset explosion-sound (load-audio (scope-asset "sounds/explosion.wav")))
+(define-asset hit-sound (load-audio (scope-asset "sounds/hit.wav")))
(define-class <enemy> (<actor>)
(health #:accessor health #:init-keyword #:health)
@@ -56,15 +57,14 @@
(parting-shots #:getter parting-shots #:init-keyword #:parting-shots)
(fire-parting-shots? #:accessor fire-parting-shots? #:init-form #f))
-(define-method (on-kill (enemy <enemy>))
- #t)
-
(define-method (damage (enemy <enemy>) x)
(let ((new-health (max (- (health enemy) x) 0)))
(set! (health enemy) new-health)
- (when (zero? new-health)
- (audio-play (asset-ref explosion-sound)
- #:volume 0.5))))
+ (if (zero? new-health)
+ (audio-play (asset-ref explosion-sound)
+ #:volume 0.5)
+ (audio-play (asset-ref hit-sound)
+ #:volume 0.5))))
(define-method (dead? (enemy <enemy>))
(zero? (health enemy)))