cutechicken commited on
Commit
6c44a38
ยท
verified ยท
1 Parent(s): 703ebee

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +45 -50
index.html CHANGED
@@ -256,58 +256,53 @@
256
  }
257
  }
258
  class SupportUnit {
259
- constructor(yPosition) {
260
- this.x = 0;
261
- this.y = yPosition;
262
- this.speed = 5;
263
- this.lastShot = 0;
264
- this.width = 100;
265
- this.height = 100;
266
- this.angle = 0; // ํ•ญ์ƒ ์˜ค๋ฅธ์ชฝ์„ ํ–ฅํ•จ
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
- // ๋ฐœ์‚ฌ (1์ดˆ์— 5๋ฐœ)
277
- const now = Date.now();
278
- if (now - this.lastShot > 200) {
279
- this.shoot();
280
- this.lastShot = now;
281
- }
282
- return this.x < canvas.width;
283
- }
284
 
285
- shoot() {
286
- // ์นด์šดํŠธ๋‹ค์šด์ด ์‹œ์ž‘๋˜๋ฉด ์žฌ์ƒ์ค‘์ธ ์†Œ๋ฆฌ๋ฅผ ์ •์ง€
287
- if (isCountingDown) {
288
- if (this.mgSound) {
289
- this.mgSound.pause();
290
- this.mgSound.currentTime = 0;
291
- }
292
- this.hasPlayedSound = false; // ์†Œ๋ฆฌ ์žฌ์ƒ ์ƒํƒœ ์ดˆ๊ธฐํ™”
293
- }
294
- // ์นด์šดํŠธ๋‹ค์šด ์ค‘์ด ์•„๋‹ ๋•Œ๋งŒ ์†Œ๋ฆฌ ์žฌ์ƒ
295
- else if (!this.hasPlayedSound) {
296
- this.mgSound = new Audio('bf109mg.ogg');
297
- this.mgSound.play().catch(error => console.error('Audio play failed:', error));
298
- this.hasPlayedSound = true;
299
- }
 
 
 
300
 
301
- bullets.push({
302
- x: this.x + Math.cos(this.angle) * 30,
303
- y: this.y + Math.sin(this.angle) * 30,
304
- angle: this.angle,
305
- speed: 10,
306
- isEnemy: false,
307
- damage: weapons.machinegun.damage,
308
- size: weapons.machinegun.bulletSize
309
- });
310
- }
 
 
 
 
 
311
  }
312
  class JU87 {
313
  constructor() {
 
256
  }
257
  }
258
  class SupportUnit {
259
+ constructor(yPosition) {
260
+ this.x = 0;
261
+ this.y = yPosition;
262
+ this.speed = 5;
263
+ this.lastShot = 0;
264
+ this.width = 100;
265
+ this.height = 100;
266
+ this.angle = 0;
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
+ }
281
+ return this.x < canvas.width;
282
+ }
283
+
284
+ shoot() {
285
+ // ์ตœ์ดˆ ๋“ฑ์žฅ์‹œ bf109mg.ogg ์žฌ์ƒ
286
+ if (!this.hasPlayedSound && !isCountingDown) {
287
+ new Audio('bf109mg.ogg').play();
288
+ this.hasPlayedSound = true;
289
+ }
290
 
291
+ // ๋งค ๋ฐœ์‚ฌ์‹œ bf109mgse.ogg ์žฌ์ƒ (์นด์šดํŠธ๋‹ค์šด ์ค‘์ด ์•„๋‹ ๋•Œ๋งŒ)
292
+ if (!isCountingDown) {
293
+ new Audio('bf109mgse.ogg').play();
294
+ }
295
+
296
+ bullets.push({
297
+ x: this.x + Math.cos(this.angle) * 30,
298
+ y: this.y + Math.sin(this.angle) * 30,
299
+ angle: this.angle,
300
+ speed: 10,
301
+ isEnemy: false,
302
+ damage: weapons.machinegun.damage,
303
+ size: weapons.machinegun.bulletSize
304
+ });
305
+ }
306
  }
307
  class JU87 {
308
  constructor() {