Spaces:
Running
Running
Update index.html
Browse files- index.html +18 -16
index.html
CHANGED
@@ -327,28 +327,30 @@
|
|
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 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
y: rotatedY,
|
343 |
-
angle: this.angle,
|
344 |
-
speed: 10,
|
345 |
-
isEnemy: false,
|
346 |
-
damage: weapons.machinegun.damage,
|
347 |
-
size: weapons.machinegun.bulletSize
|
348 |
-
});
|
349 |
-
});
|
350 |
-
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
update() {
|
353 |
if (!this.hasPlayedSound) {
|
354 |
const sirenSound = new Audio('ju87siren.ogg');
|
|
|
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 |
+
// ๊ธฐ๊ด์ด ์์น๋ฅผ ์ค์ ๊ธฐ์ค์ผ๋ก ์ข์ฐ ๋์นญ์ผ๋ก ๋ณ๊ฒฝ
|
337 |
+
// ์ค์์์ ์ข์ฐ 15ํฝ์
๋จ์ด์ง ์์น์์ ๋ฐ์ฌ
|
338 |
+
[[-15, 0], [15, 0]].forEach(([offsetX, offsetY]) => {
|
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 |
|
343 |
+
bullets.push({
|
344 |
+
x: rotatedX,
|
345 |
+
y: rotatedY,
|
346 |
+
angle: this.angle,
|
347 |
+
speed: 10,
|
348 |
+
isEnemy: false,
|
349 |
+
damage: weapons.machinegun.damage * 2,
|
350 |
+
size: weapons.machinegun.bulletSize
|
351 |
+
});
|
352 |
+
});
|
353 |
+
}
|
354 |
update() {
|
355 |
if (!this.hasPlayedSound) {
|
356 |
const sirenSound = new Audio('ju87siren.ogg');
|