cutechicken commited on
Commit
c4a4930
ยท
verified ยท
1 Parent(s): 1ddb05f

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +16 -12
index.html CHANGED
@@ -324,19 +324,23 @@
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
- // ๊ธฐ๊ด€์ด ์œ„์น˜๋ฅผ ์ค‘์•™ ๊ธฐ์ค€์œผ๋กœ ์ขŒ์šฐ ๋Œ€์นญ์œผ๋กœ ๋ณ€๊ฒฝ
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
 
 
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