cutechicken commited on
Commit
6107a7f
·
verified ·
1 Parent(s): 82b896b

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +18 -6
game.js CHANGED
@@ -546,10 +546,16 @@ startReload() {
546
  }
547
 
548
  takeDamage(damage) {
549
- this.health -= damage;
550
- return this.health <= 0;
 
 
 
 
 
551
  }
552
-
 
553
  startReload() {
554
  this.isReloading = true;
555
  const reloadingText = document.getElementById('reloadingText');
@@ -1254,10 +1260,16 @@ checkPathClear(start, end) {
1254
  }
1255
 
1256
  takeDamage(damage) {
1257
- this.health -= damage;
1258
- return this.health <= 0;
1259
- }
1260
 
 
 
 
 
 
 
 
 
1261
  destroy() {
1262
  if (this.mesh) {
1263
  this.scene.remove(this.mesh);
 
546
  }
547
 
548
  takeDamage(damage) {
549
+ this.health -= damage;
550
+
551
+ // 사망 여부 체크
552
+ if (this.health <= 0) {
553
+ const deathSound = new Audio('sounds/bang.ogg');
554
+ deathSound.play();
555
+ return true; // 사망
556
  }
557
+ return false; // 생존
558
+ }
559
  startReload() {
560
  this.isReloading = true;
561
  const reloadingText = document.getElementById('reloadingText');
 
1260
  }
1261
 
1262
  takeDamage(damage) {
1263
+ this.health -= damage;
 
 
1264
 
1265
+ // 사망 여부 체크
1266
+ if (this.health <= 0) {
1267
+ const deathSound = new Audio('sounds/bang.ogg');
1268
+ deathSound.play();
1269
+ return true; // 사망
1270
+ }
1271
+ return false; // 생존
1272
+ }
1273
  destroy() {
1274
  if (this.mesh) {
1275
  this.scene.remove(this.mesh);