Update index.html
Browse files- index.html +16 -12
index.html
CHANGED
@@ -324,19 +324,23 @@
|
|
324 |
enemies[Math.floor(Math.random() * enemies.length)] : null;
|
325 |
}
|
326 |
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
|
336 |
-
|
337 |
-
//
|
338 |
-
|
339 |
-
|
|
|
|
|
|
|
|
|
340 |
const rotatedX = this.x + (Math.cos(this.angle) * offsetX - Math.sin(this.angle) * offsetY);
|
341 |
const rotatedY = this.y + (Math.sin(this.angle) * offsetX + Math.cos(this.angle) * offsetY);
|
342 |
|
|
|
324 |
enemies[Math.floor(Math.random() * enemies.length)] : null;
|
325 |
}
|
326 |
|
327 |
+
shoot() {
|
328 |
+
if (!this.hasPlayedMGSound) {
|
329 |
+
const mgSound = new Audio('ju87mg.ogg');
|
330 |
+
mgSound.volume = 1.0;
|
331 |
+
mgSound.currentTime = 0;
|
332 |
+
mgSound.play().catch(error => console.error('Audio play failed:', error));
|
333 |
+
this.hasPlayedMGSound = true;
|
334 |
+
}
|
335 |
|
336 |
+
// 100x100 ํฝ์
๊ธฐ์ค์ผ๋ก ๋ ๊ฐ ์์น ์ขํ ์ค์
|
337 |
+
// ์ผ์ชฝ ๋ ๊ฐ: [20, 50] (์ผ์ชฝ์์ 20px, ์์์ 50px)
|
338 |
+
// ์ค๋ฅธ์ชฝ ๋ ๊ฐ: [80, 50] (์ผ์ชฝ์์ 80px, ์์์ 50px)
|
339 |
+
[[20, 50], [80, 50]].forEach(([x, y]) => {
|
340 |
+
// ์ด๋ฏธ์ง ์ค์ฌ์ (50,50)์ผ๋ก ํ์ฌ ์ขํ ๋ณํ
|
341 |
+
const offsetX = x - 50;
|
342 |
+
const offsetY = y - 50;
|
343 |
+
|
344 |
const rotatedX = this.x + (Math.cos(this.angle) * offsetX - Math.sin(this.angle) * offsetY);
|
345 |
const rotatedY = this.y + (Math.sin(this.angle) * offsetX + Math.cos(this.angle) * offsetY);
|
346 |
|