Spaces:
Running
Running
Update index.html
Browse files- index.html +22 -7
index.html
CHANGED
|
@@ -255,7 +255,7 @@
|
|
| 255 |
return Date.now() - this.startTime > this.duration;
|
| 256 |
}
|
| 257 |
}
|
| 258 |
-
|
| 259 |
constructor(yPosition) {
|
| 260 |
this.x = 0;
|
| 261 |
this.y = yPosition;
|
|
@@ -267,14 +267,25 @@
|
|
| 267 |
this.img = new Image();
|
| 268 |
this.img.src = 'bf109.png';
|
| 269 |
this.hasPlayedSound = false; // ์ฒซ ๋ฑ์ฅ ์๋ฆฌ์ฉ
|
|
|
|
| 270 |
}
|
| 271 |
|
| 272 |
update() {
|
| 273 |
// ์ด๋
|
| 274 |
this.x += this.speed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
// ๋ฐ์ฌ (1์ด์ 5๋ฐ)
|
| 276 |
const now = Date.now();
|
| 277 |
-
if (now - this.lastShot > 200) {
|
| 278 |
this.shoot();
|
| 279 |
this.lastShot = now;
|
| 280 |
}
|
|
@@ -282,15 +293,19 @@
|
|
| 282 |
}
|
| 283 |
|
| 284 |
shoot() {
|
| 285 |
-
// ์ต์ด
|
| 286 |
-
if (!this.hasPlayedSound
|
| 287 |
-
new Audio('bf109mg.ogg')
|
|
|
|
|
|
|
| 288 |
this.hasPlayedSound = true;
|
| 289 |
}
|
| 290 |
|
| 291 |
-
//
|
| 292 |
if (!isCountingDown) {
|
| 293 |
-
new Audio('bf109mgse.ogg')
|
|
|
|
|
|
|
| 294 |
}
|
| 295 |
|
| 296 |
bullets.push({
|
|
|
|
| 255 |
return Date.now() - this.startTime > this.duration;
|
| 256 |
}
|
| 257 |
}
|
| 258 |
+
class SupportUnit {
|
| 259 |
constructor(yPosition) {
|
| 260 |
this.x = 0;
|
| 261 |
this.y = yPosition;
|
|
|
|
| 267 |
this.img = new Image();
|
| 268 |
this.img.src = 'bf109.png';
|
| 269 |
this.hasPlayedSound = false; // ์ฒซ ๋ฑ์ฅ ์๋ฆฌ์ฉ
|
| 270 |
+
this.mgSound = null; // ๊ธฐ๊ด์ด ์๋ฆฌ ๊ฐ์ฒด
|
| 271 |
}
|
| 272 |
|
| 273 |
update() {
|
| 274 |
// ์ด๋
|
| 275 |
this.x += this.speed;
|
| 276 |
+
|
| 277 |
+
// ์นด์ดํธ๋ค์ด ์ค์ด๋ฉด ์๋ฆฌ ์ ์ง ๋ฐ ์ด๊ธฐํ
|
| 278 |
+
if (isCountingDown) {
|
| 279 |
+
if (this.mgSound) {
|
| 280 |
+
this.mgSound.pause();
|
| 281 |
+
this.mgSound.currentTime = 0;
|
| 282 |
+
}
|
| 283 |
+
this.hasPlayedSound = false;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
// ๋ฐ์ฌ (1์ด์ 5๋ฐ)
|
| 287 |
const now = Date.now();
|
| 288 |
+
if (now - this.lastShot > 200 && !isCountingDown) {
|
| 289 |
this.shoot();
|
| 290 |
this.lastShot = now;
|
| 291 |
}
|
|
|
|
| 293 |
}
|
| 294 |
|
| 295 |
shoot() {
|
| 296 |
+
// ์ต์ด ๋ฑ์ฅ์์๋ง bf109mg.ogg ์ฌ์
|
| 297 |
+
if (!this.hasPlayedSound) {
|
| 298 |
+
const firstSound = new Audio('bf109mg.ogg');
|
| 299 |
+
firstSound.volume = 0.5;
|
| 300 |
+
firstSound.play();
|
| 301 |
this.hasPlayedSound = true;
|
| 302 |
}
|
| 303 |
|
| 304 |
+
// ๋ฐ์ฌํ ๋๋ง๋ค ์๋ก์ด bf109mgse.ogg ์ฌ์
|
| 305 |
if (!isCountingDown) {
|
| 306 |
+
const shootSound = new Audio('bf109mgse.ogg');
|
| 307 |
+
shootSound.volume = 0.3; // ๋ณผ๋ฅจ ๋ฎ์ถค
|
| 308 |
+
shootSound.play();
|
| 309 |
}
|
| 310 |
|
| 311 |
bullets.push({
|