cutechicken commited on
Commit
a264f3f
ยท
verified ยท
1 Parent(s): a21c9f5

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +329 -216
index.html CHANGED
@@ -879,7 +879,7 @@ const defaultPlayerStats = {
879
  constructor(y) {
880
  this.y = y;
881
  this.startTime = Date.now();
882
- this.duration = 2000; // 2์ดˆ
883
  }
884
 
885
  draw(ctx) {
@@ -1684,137 +1684,147 @@ bullets = bullets.filter(bullet => {
1684
  }
1685
  }
1686
  function drawGame() {
1687
- ctx.clearRect(0, 0, canvas.width, canvas.height);
1688
-
1689
- // ๋ฐฐ๊ฒฝ ๊ทธ๋ฆฌ๊ธฐ
1690
- const pattern = ctx.createPattern(backgroundImg, 'repeat');
1691
- ctx.fillStyle = pattern;
1692
- ctx.fillRect(0, 0, canvas.width, canvas.height);
1693
-
1694
- // ํ”Œ๋ ˆ์ด์–ด ๊ทธ๋ฆฌ๊ธฐ
1695
- ctx.save();
1696
- ctx.translate(player.x, player.y);
1697
- ctx.rotate(player.angle);
1698
- ctx.drawImage(playerImg, -player.width/2, -player.height/2, player.width, player.height);
1699
- ctx.restore();
1700
-
1701
- // ์ฒด๋ ฅ๋ฐ” ๊ทธ๋ฆฌ๊ธฐ
1702
- drawHealthBar(canvas.width/2, 30, player.health, player.maxHealth, 200, 20, 'green');
1703
-
1704
- // ์  ๊ทธ๋ฆฌ๊ธฐ
1705
- enemies.forEach(enemy => {
1706
- ctx.save();
1707
- ctx.translate(enemy.x, enemy.y);
1708
- ctx.rotate(enemy.angle);
1709
- const img = enemy.enemyImg;
1710
- ctx.drawImage(img, -enemy.width/2, -enemy.height/2, enemy.width, enemy.height);
1711
- ctx.restore();
1712
- drawHealthBar(enemy.x, enemy.y - 40, enemy.health, enemy.maxHealth, 60, 5, 'red');
1713
- });
1714
-
1715
- // ์•„๊ตฐ ์œ ๋‹› ๊ทธ๋ฆฌ๊ธฐ
1716
- allyUnits.forEach(ally => {
1717
- ctx.save();
1718
- ctx.translate(ally.x, ally.y);
1719
- ctx.rotate(ally.angle);
1720
- ctx.drawImage(ally.img, -ally.width/2, -ally.height/2, ally.width, ally.height);
1721
- ctx.restore();
1722
- drawHealthBar(ally.x, ally.y - 40, ally.health, ally.maxHealth, 60, 5, 'blue');
1723
- });
1724
-
1725
- // ๊ฒฝ๊ณ ์„  ๊ทธ๋ฆฌ๊ธฐ
1726
- warningLines.forEach(line => line.draw(ctx));
1727
-
1728
- // ์Šคํ•ํŒŒ์ด์–ด ๊ฒฝ๊ณ ์„  ๊ทธ๋ฆฌ๊ธฐ
1729
- p51WarningLines.forEach(line => line.draw(ctx));
1730
-
1731
- // B-29 ๊ฒฝ๊ณ ์„  ๊ทธ๋ฆฌ๊ธฐ
1732
- b29WarningLines.forEach(line => line.draw(ctx));
1733
-
1734
- // P51 ๊ทธ๋ฆฌ๊ธฐ
1735
- p51s.forEach(p51 => {
1736
- ctx.save();
1737
- ctx.translate(p51.x, p51.y);
1738
- ctx.rotate(Math.PI / 2); // P51์€ ์•„๋ž˜๋กœ ์ˆ˜์ง ์ด๋™ํ•˜๋ฏ€๋กœ 90๋„๊ฐ€ ์•„๋‹Œ 180๋„ ํšŒ์ „(ctx.rotate(Math.PI / 2);)
1739
- ctx.drawImage(p51.img, -p51.width/2, -p51.height/2, p51.width, p51.height);
1740
- ctx.restore();
1741
- });
1742
-
1743
- // B-29 ๊ทธ๋ฆฌ๊ธฐ
1744
- b29s.forEach(b29 => {
1745
- ctx.save();
1746
- ctx.translate(b29.x, b29.y);
1747
- ctx.rotate(Math.PI); // B-29๋Š” ์™ผ์ชฝ์œผ๋กœ ์ด๋™ํ•˜๋ฏ€๋กœ 180๋„ ํšŒ์ „
1748
- ctx.drawImage(b29.img, -b29.width/2, -b29.height/2, b29.width, b29.height);
1749
- ctx.restore();
1750
- });
1751
-
1752
- // ์Šคํ•ํŒŒ์ด์–ด ๊ทธ๋ฆฌ๊ธฐ
1753
- spitfires.forEach(spitfire => {
1754
- ctx.save();
1755
- ctx.translate(spitfire.x, spitfire.y);
1756
- ctx.rotate(Math.PI);
1757
- ctx.drawImage(spitfire.img, -spitfire.width/2, -spitfire.height/2, spitfire.width, spitfire.height);
1758
- ctx.restore();
1759
- });
1760
-
1761
- // ์ง€์› ์œ ๋‹› ๊ทธ๋ฆฌ๊ธฐ
1762
- supportUnits.forEach(unit => {
1763
- ctx.save();
1764
- ctx.translate(unit.x, unit.y);
1765
- ctx.rotate(unit.angle);
1766
- ctx.drawImage(unit.img, -unit.width/2, -unit.height/2, unit.width, unit.height);
1767
- ctx.restore();
1768
- });
1769
-
1770
- // ์ด์•Œ ๊ทธ๋ฆฌ๊ธฐ
1771
- bullets.forEach(bullet => {
1772
- if (bullet.isEnemy || !bullet.isAPCR) {
1773
- ctx.beginPath();
1774
- ctx.fillStyle = bullet.color || (bullet.isEnemy ? 'red' : 'blue');
1775
- ctx.arc(bullet.x, bullet.y, bullet.size, 0, Math.PI * 2);
1776
- ctx.fill();
1777
- } else {
1778
- ctx.save();
1779
- ctx.translate(bullet.x, bullet.y);
1780
- ctx.rotate(bullet.angle);
1781
- const width = currentWeapon === 'machinegun' ? 10 : 20;
1782
- const height = currentWeapon === 'machinegun' ? 5 : 10;
1783
- ctx.drawImage(bulletImg, -width/2, -height/2, width, height);
1784
- ctx.restore();
1785
- }
1786
- });
1787
-
1788
- // ์•„์ดํ…œ ๊ทธ๋ฆฌ๊ธฐ
1789
- items.forEach(item => {
1790
- ctx.beginPath();
1791
- ctx.fillStyle = 'green';
1792
- ctx.arc(item.x, item.y, 10, 0, Math.PI * 2);
1793
- ctx.fill();
1794
- });
1795
-
1796
- // UI ๊ทธ๋ฆฌ๊ธฐ
1797
- ctx.fillStyle = 'white';
1798
- ctx.font = '24px Arial';
1799
- ctx.fillText(`Stage ${currentStage} - Round ${currentRound}/${currentStage === 3 ? 20 : 10}`, 10, 30);
1800
- ctx.fillText(`Gold: ${gold}`, 10, 60);
1801
-
1802
- // ์ดํŽ™ํŠธ ๊ทธ๋ฆฌ๊ธฐ
1803
- effects = effects.filter(effect => !effect.isExpired());
1804
- effects.forEach(effect => {
1805
- effect.update();
1806
- ctx.save();
1807
- ctx.translate(effect.x, effect.y);
1808
- if (effect.type === 'fire') ctx.rotate(effect.angle);
1809
- ctx.drawImage(effect.img, -effect.size/2, -effect.size/2, effect.size, effect.size);
1810
- ctx.restore();
1811
- });
 
 
 
 
 
 
 
 
 
 
1812
 
1813
- // ์นด์šดํŠธ๋‹ค์šด ์˜ค๋ฒ„๋ ˆ์ด
1814
- if (isCountingDown) {
1815
- ctx.fillStyle = 'rgba(0, 0, 0, 0.5)';
1816
- ctx.fillRect(0, 0, canvas.width, canvas.height);
1817
- }
1818
  }
1819
  //bf109 ํžˆํŠธ ์‹œ์Šคํ…œ
1820
  function updateBF109Damage() {
@@ -2007,73 +2017,120 @@ class Enemy {
2007
  }
2008
 
2009
  shoot() {
2010
- if (currentStage === 3) {
2011
- if (this.isBoss) {
2012
- const bossSound = new Audio('fireenemy2.ogg');
2013
- bossSound.volume = 0.5;
2014
- bossSound.play();
2015
-
2016
- // ๋ณด์Šค ๋ฐ๋ฏธ์ง€๋ฅผ 1.5๋ฐฐ๋กœ ์ฆ๊ฐ€ (300 -> 450)
2017
- bullets.push({
2018
- x: this.x + Math.cos(this.angle) * 30,
2019
- y: this.y + Math.sin(this.angle) * 30,
2020
- angle: this.angle,
2021
- speed: 15,
2022
- isEnemy: true,
2023
- damage: 450, // 300์—์„œ 450์œผ๋กœ ์ฆ๊ฐ€
2024
- size: 5
2025
- });
2026
- } else if (this.isElite) {
2027
- const eliteSound = new Audio('fireenemy3.ogg');
2028
- eliteSound.volume = 0.5;
2029
- eliteSound.play();
2030
-
2031
- bullets.push({
2032
- x: this.x + Math.cos(this.angle) * 30,
2033
- y: this.y + Math.sin(this.angle) * 30,
2034
- angle: this.angle,
2035
- speed: 8,
2036
- isEnemy: true,
2037
- damage: 200,
2038
- size: 4
2039
- });
2040
- } else {
2041
- enemyFireSound.cloneNode().play();
2042
-
2043
- bullets.push({
2044
- x: this.x + Math.cos(this.angle) * 30,
2045
- y: this.y + Math.sin(this.angle) * 30,
2046
- angle: this.angle,
2047
- speed: 5,
2048
- isEnemy: true,
2049
- damage: 100,
2050
- size: 3
2051
- });
2052
- }
2053
- } else {
2054
- const sound = this.isBoss ? new Audio('firemn.ogg') : enemyFireSound.cloneNode();
2055
- sound.play();
2056
-
2057
- effects.push(new Effect(
2058
- this.x + Math.cos(this.angle) * 30,
2059
- this.y + Math.sin(this.angle) * 30,
2060
- 500,
2061
- 'fire',
2062
- this.angle,
2063
- this
2064
- ));
2065
-
2066
- bullets.push({
2067
- x: this.x + Math.cos(this.angle) * 30,
2068
- y: this.y + Math.sin(this.angle) * 30,
2069
- angle: this.angle,
2070
- speed: this.isBoss ? 10 : 5,
2071
- isEnemy: true,
2072
- size: this.isBoss ? 5 : 3,
2073
- damage: this.isBoss ? 450 : 150 // ๋ณด์Šค ๋ฐ๋ฏธ์ง€๋„ 1.5๋ฐฐ๋กœ ์ฆ๊ฐ€
2074
- });
2075
- }
2076
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2077
  }
2078
  // ๋ณด์Šค ์Šคํ…Œ์ด์ง€ ์‹œ์ž‘ ํ•จ์ˆ˜ ์ˆ˜์ •
2079
  function startBossStage() {
@@ -2165,18 +2222,38 @@ function fireBullet() {
2165
  const now = Date.now();
2166
  if ((keys[' '] || autoFire) && now - lastShot > weapon.fireRate) {
2167
  weapon.sound.cloneNode().play();
2168
- effects.push(new Effect(
2169
- player.x + Math.cos(player.angle) * 30,
2170
- player.y + Math.sin(player.angle) * 30,
2171
- 500,
2172
- 'fire',
2173
- player.angle,
2174
- player
2175
- ));
2176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2177
  bullets.push({
2178
- x: player.x + Math.cos(player.angle) * 30,
2179
- y: player.y + Math.sin(player.angle) * 30,
2180
  angle: player.angle,
2181
  speed: hasAPCR ? 20 : 10,
2182
  isEnemy: false,
@@ -2201,6 +2278,17 @@ class Effect {
2201
  this.offset = { x: Math.cos(angle) * 30, y: Math.sin(angle) * 30 };
2202
  this.img = new Image();
2203
 
 
 
 
 
 
 
 
 
 
 
 
2204
  // ์ดํŽ™ํŠธ ํƒ€์ž…์— ๋”ฐ๋ฅธ ์ด๋ฏธ์ง€ ์„ค์ •
2205
  if (type === 'death') {
2206
  this.img.src = 'bang.png';
@@ -2208,21 +2296,46 @@ class Effect {
2208
  this.img.src = 'bomb1.png';
2209
  } else if (type === 'hit') {
2210
  this.img.src = 'fire3.png';
 
 
 
 
2211
  } else {
2212
  this.img.src = 'fire2.png';
2213
  }
2214
 
2215
- // ์ดํŽ™ํŠธ ํƒ€์ž…์— ๋”ฐ๋ฅธ ํฌ๊ธฐ ์„ค์ •
2216
- this.size = type === 'bomb' ? 100 : // ํญ๋ฐœ์€ ๋” ํฌ๊ฒŒ
2217
  type === 'death' ? 75 :
2218
- type === 'hit' ? 30 : 42; // ๋ช…์ค‘ ์ดํŽ™ํŠธ๋Š” ๋” ์ž‘๊ฒŒ
2219
- }
2220
 
2221
  update() {
2222
- if(this.parent && this.type === 'fire') {
2223
- this.x = this.parent.x + this.offset.x;
2224
- this.y = this.parent.y + this.offset.y;
2225
- this.angle = this.parent.angle;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2226
  }
2227
  }
2228
 
 
879
  constructor(y) {
880
  this.y = y;
881
  this.startTime = Date.now();
882
+ this.duration = 750; // 0.75์ดˆ
883
  }
884
 
885
  draw(ctx) {
 
1684
  }
1685
  }
1686
  function drawGame() {
1687
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
1688
+
1689
+ // ๋ฐฐ๊ฒฝ ๊ทธ๋ฆฌ๊ธฐ
1690
+ const pattern = ctx.createPattern(backgroundImg, 'repeat');
1691
+ ctx.fillStyle = pattern;
1692
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
1693
+
1694
+ // ํ”Œ๋ ˆ์ด์–ด ๊ทธ๋ฆฌ๊ธฐ
1695
+ ctx.save();
1696
+ ctx.translate(player.x, player.y);
1697
+ ctx.rotate(player.angle);
1698
+ ctx.drawImage(playerImg, -player.width/2, -player.height/2, player.width, player.height);
1699
+ ctx.restore();
1700
+
1701
+ // ์ฒด๋ ฅ๋ฐ” ๊ทธ๋ฆฌ๊ธฐ
1702
+ drawHealthBar(canvas.width/2, 30, player.health, player.maxHealth, 200, 20, 'green');
1703
+
1704
+ // ์  ๊ทธ๋ฆฌ๊ธฐ
1705
+ enemies.forEach(enemy => {
1706
+ ctx.save();
1707
+ ctx.translate(enemy.x, enemy.y);
1708
+ ctx.rotate(enemy.angle);
1709
+ const img = enemy.enemyImg;
1710
+ ctx.drawImage(img, -enemy.width/2, -enemy.height/2, enemy.width, enemy.height);
1711
+ ctx.restore();
1712
+ drawHealthBar(enemy.x, enemy.y - 40, enemy.health, enemy.maxHealth, 60, 5, 'red');
1713
+ });
1714
+
1715
+ // ์•„๊ตฐ ์œ ๋‹› ๊ทธ๋ฆฌ๊ธฐ
1716
+ allyUnits.forEach(ally => {
1717
+ ctx.save();
1718
+ ctx.translate(ally.x, ally.y);
1719
+ ctx.rotate(ally.angle);
1720
+ ctx.drawImage(ally.img, -ally.width/2, -ally.height/2, ally.width, ally.height);
1721
+ ctx.restore();
1722
+ drawHealthBar(ally.x, ally.y - 40, ally.health, ally.maxHealth, 60, 5, 'blue');
1723
+ });
1724
+
1725
+ // ๊ฒฝ๊ณ ์„  ๊ทธ๋ฆฌ๊ธฐ
1726
+ warningLines.forEach(line => line.draw(ctx));
1727
+
1728
+ // ์Šคํ•ํŒŒ์ด์–ด ๊ฒฝ๊ณ ์„  ๊ทธ๋ฆฌ๊ธฐ
1729
+ p51WarningLines.forEach(line => line.draw(ctx));
1730
+
1731
+ // B-29 ๊ฒฝ๊ณ ์„  ๊ทธ๋ฆฌ๊ธฐ
1732
+ b29WarningLines.forEach(line => line.draw(ctx));
1733
+
1734
+ // P51 ๊ทธ๋ฆฌ๊ธฐ
1735
+ p51s.forEach(p51 => {
1736
+ ctx.save();
1737
+ ctx.translate(p51.x, p51.y);
1738
+ ctx.rotate(Math.PI / 2);
1739
+ ctx.drawImage(p51.img, -p51.width/2, -p51.height/2, p51.width, p51.height);
1740
+ ctx.restore();
1741
+ });
1742
+
1743
+ // B-29 ๊ทธ๋ฆฌ๊ธฐ
1744
+ b29s.forEach(b29 => {
1745
+ ctx.save();
1746
+ ctx.translate(b29.x, b29.y);
1747
+ ctx.rotate(Math.PI);
1748
+ ctx.drawImage(b29.img, -b29.width/2, -b29.height/2, b29.width, b29.height);
1749
+ ctx.restore();
1750
+ });
1751
+
1752
+ // ์Šคํ•ํŒŒ์ด์–ด ๊ทธ๋ฆฌ๊ธฐ
1753
+ spitfires.forEach(spitfire => {
1754
+ ctx.save();
1755
+ ctx.translate(spitfire.x, spitfire.y);
1756
+ ctx.rotate(Math.PI);
1757
+ ctx.drawImage(spitfire.img, -spitfire.width/2, -spitfire.height/2, spitfire.width, spitfire.height);
1758
+ ctx.restore();
1759
+ });
1760
+
1761
+ // ์ง€์› ์œ ๋‹› ๊ทธ๋ฆฌ๊ธฐ
1762
+ supportUnits.forEach(unit => {
1763
+ ctx.save();
1764
+ ctx.translate(unit.x, unit.y);
1765
+ ctx.rotate(unit.angle);
1766
+ ctx.drawImage(unit.img, -unit.width/2, -unit.height/2, unit.width, unit.height);
1767
+ ctx.restore();
1768
+ });
1769
+
1770
+ // ์ด์•Œ ๊ทธ๋ฆฌ๊ธฐ
1771
+ bullets.forEach(bullet => {
1772
+ if (bullet.isEnemy || !bullet.isAPCR) {
1773
+ ctx.beginPath();
1774
+ ctx.fillStyle = bullet.color || (bullet.isEnemy ? 'red' : 'blue');
1775
+ ctx.arc(bullet.x, bullet.y, bullet.size, 0, Math.PI * 2);
1776
+ ctx.fill();
1777
+ } else {
1778
+ ctx.save();
1779
+ ctx.translate(bullet.x, bullet.y);
1780
+ ctx.rotate(bullet.angle);
1781
+ const width = currentWeapon === 'machinegun' ? 10 : 20;
1782
+ const height = currentWeapon === 'machinegun' ? 5 : 10;
1783
+ ctx.drawImage(bulletImg, -width/2, -height/2, width, height);
1784
+ ctx.restore();
1785
+ }
1786
+ });
1787
+
1788
+ // ์•„์ดํ…œ ๊ทธ๋ฆฌ๊ธฐ
1789
+ items.forEach(item => {
1790
+ ctx.beginPath();
1791
+ ctx.fillStyle = 'green';
1792
+ ctx.arc(item.x, item.y, 10, 0, Math.PI * 2);
1793
+ ctx.fill();
1794
+ });
1795
+
1796
+ // UI ๊ทธ๋ฆฌ๊ธฐ
1797
+ ctx.fillStyle = 'white';
1798
+ ctx.font = '24px Arial';
1799
+ ctx.fillText(`Stage ${currentStage} - Round ${currentRound}/${currentStage === 3 ? 20 : 10}`, 10, 30);
1800
+ ctx.fillText(`Gold: ${gold}`, 10, 60);
1801
+
1802
+ // ์ดํŽ™ํŠธ ๊ทธ๋ฆฌ๊ธฐ
1803
+ effects = effects.filter(effect => !effect.isExpired());
1804
+ effects.forEach(effect => {
1805
+ effect.update();
1806
+ ctx.save();
1807
+ ctx.translate(effect.x, effect.y);
1808
+ if (effect.type === 'fire' || effect.type === 'cannon_fire') {
1809
+ ctx.rotate(effect.angle);
1810
+ }
1811
+
1812
+ if (effect.type === 'cannon_fire') {
1813
+ // ์บ๋…ผ ๋ฐœ์‚ฌ ํšจ๊ณผ๋Š” ํ˜„์žฌ ๋‹จ๊ณ„์˜ ํฌ๊ธฐ์— ๋งž์ถฐ ๊ทธ๋ฆฌ๊ธฐ
1814
+ const size = effect.currentSize;
1815
+ ctx.drawImage(effect.img, -size.width/2, -size.height/2, size.width, size.height);
1816
+ } else {
1817
+ // ๋‹ค๋ฅธ ์ดํŽ™ํŠธ๋“ค์€ ๊ธฐ์กด ๋ฐฉ์‹๋Œ€๋กœ ๊ทธ๋ฆฌ๊ธฐ
1818
+ ctx.drawImage(effect.img, -effect.size/2, -effect.size/2, effect.size, effect.size);
1819
+ }
1820
+ ctx.restore();
1821
+ });
1822
 
1823
+ // ์นด์šดํŠธ๋‹ค์šด ์˜ค๋ฒ„๋ ˆ์ด
1824
+ if (isCountingDown) {
1825
+ ctx.fillStyle = 'rgba(0, 0, 0, 0.5)';
1826
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
1827
+ }
1828
  }
1829
  //bf109 ํžˆํŠธ ์‹œ์Šคํ…œ
1830
  function updateBF109Damage() {
 
2017
  }
2018
 
2019
  shoot() {
2020
+ if (currentStage === 3) {
2021
+ if (this.isBoss) {
2022
+ const bossSound = new Audio('fireenemy2.ogg');
2023
+ bossSound.volume = 0.5;
2024
+ bossSound.play();
2025
+
2026
+ // ๋ณด์Šค์˜ ์ด๊ตฌ ์œ„์น˜ ๊ณ„์‚ฐ (์ขŒ์šฐ ์–‘์ชฝ์—์„œ ๋ฐœ์‚ฌ)
2027
+ const gunPositions = [
2028
+ { x: this.x + Math.cos(this.angle) * 30, y: this.y + Math.sin(this.angle) * 30 },
2029
+ { x: this.x + Math.cos(this.angle + Math.PI) * 30, y: this.y + Math.sin(this.angle + Math.PI) * 30 }
2030
+ ];
2031
+
2032
+ // ๊ฐ ์ด๊ตฌ์—์„œ ๋ฐœ์‚ฌ ํšจ๊ณผ ์ƒ์„ฑ
2033
+ gunPositions.forEach(pos => {
2034
+ effects.push(new Effect(
2035
+ pos.x,
2036
+ pos.y,
2037
+ 750, // 0.75์ดˆ ๋™์•ˆ ์ง€์†
2038
+ 'cannon_fire',
2039
+ this.angle,
2040
+ this
2041
+ ));
2042
+
2043
+ bullets.push({
2044
+ x: pos.x,
2045
+ y: pos.y,
2046
+ angle: this.angle,
2047
+ speed: 15,
2048
+ isEnemy: true,
2049
+ damage: 450,
2050
+ size: 5
2051
+ });
2052
+ });
2053
+ } else if (this.isElite) {
2054
+ const eliteSound = new Audio('fireenemy3.ogg');
2055
+ eliteSound.volume = 0.5;
2056
+ eliteSound.play();
2057
+
2058
+ effects.push(new Effect(
2059
+ this.x + Math.cos(this.angle) * 30,
2060
+ this.y + Math.sin(this.angle) * 30,
2061
+ 750, // 0.75์ดˆ ๋™์•ˆ ์ง€์†
2062
+ 'cannon_fire',
2063
+ this.angle,
2064
+ this
2065
+ ));
2066
+
2067
+ bullets.push({
2068
+ x: this.x + Math.cos(this.angle) * 30,
2069
+ y: this.y + Math.sin(this.angle) * 30,
2070
+ angle: this.angle,
2071
+ speed: 8,
2072
+ isEnemy: true,
2073
+ damage: 200,
2074
+ size: 4
2075
+ });
2076
+ } else {
2077
+ enemyFireSound.cloneNode().play();
2078
+
2079
+ effects.push(new Effect(
2080
+ this.x + Math.cos(this.angle) * 30,
2081
+ this.y + Math.sin(this.angle) * 30,
2082
+ 500,
2083
+ 'fire',
2084
+ this.angle,
2085
+ this
2086
+ ));
2087
+
2088
+ bullets.push({
2089
+ x: this.x + Math.cos(this.angle) * 30,
2090
+ y: this.y + Math.sin(this.angle) * 30,
2091
+ angle: this.angle,
2092
+ speed: 5,
2093
+ isEnemy: true,
2094
+ damage: 100,
2095
+ size: 3
2096
+ });
2097
+ }
2098
+ } else {
2099
+ const sound = this.isBoss ? new Audio('firemn.ogg') : enemyFireSound.cloneNode();
2100
+ sound.play();
2101
+
2102
+ // ๋ณด์Šค์™€ ์ •์˜ˆ ์œ ๋‹›์€ cannon_fire ํšจ๊ณผ๋ฅผ ์‚ฌ์šฉ
2103
+ if (this.isBoss || this.isElite) {
2104
+ effects.push(new Effect(
2105
+ this.x + Math.cos(this.angle) * 30,
2106
+ this.y + Math.sin(this.angle) * 30,
2107
+ 750, // 0.75์ดˆ ๋™์•ˆ ์ง€์†
2108
+ 'cannon_fire',
2109
+ this.angle,
2110
+ this
2111
+ ));
2112
+ } else {
2113
+ effects.push(new Effect(
2114
+ this.x + Math.cos(this.angle) * 30,
2115
+ this.y + Math.sin(this.angle) * 30,
2116
+ 500,
2117
+ 'fire',
2118
+ this.angle,
2119
+ this
2120
+ ));
2121
+ }
2122
+
2123
+ bullets.push({
2124
+ x: this.x + Math.cos(this.angle) * 30,
2125
+ y: this.y + Math.sin(this.angle) * 30,
2126
+ angle: this.angle,
2127
+ speed: this.isBoss ? 10 : 5,
2128
+ isEnemy: true,
2129
+ size: this.isBoss ? 5 : 3,
2130
+ damage: this.isBoss ? 450 : 150
2131
+ });
2132
+ }
2133
+ }
2134
  }
2135
  // ๋ณด์Šค ์Šคํ…Œ์ด์ง€ ์‹œ์ž‘ ํ•จ์ˆ˜ ์ˆ˜์ •
2136
  function startBossStage() {
 
2222
  const now = Date.now();
2223
  if ((keys[' '] || autoFire) && now - lastShot > weapon.fireRate) {
2224
  weapon.sound.cloneNode().play();
 
 
 
 
 
 
 
 
2225
 
2226
+ // ์ด๊ตฌ ์œ„์น˜ ๊ณ„์‚ฐ
2227
+ const muzzleX = player.x + Math.cos(player.angle) * (player.width/2);
2228
+ const muzzleY = player.y + Math.sin(player.angle) * (player.width/2);
2229
+
2230
+ // ๋ฌด๊ธฐ ํƒ€์ž…์— ๋”ฐ๋ฅธ ์ดํŽ™ํŠธ ์ƒ์„ฑ
2231
+ if (currentWeapon === 'cannon') {
2232
+ // ์บ๋…ผ ๋ฐœ์‚ฌ ํšจ๊ณผ (shot1->shot2->shot3 ์ˆœ์„œ๋กœ ๋ณ€๊ฒฝ)
2233
+ effects.push(new Effect(
2234
+ muzzleX,
2235
+ muzzleY,
2236
+ 1500, // ์ „์ฒด ์ง€์†์‹œ๊ฐ„ 1.5์ดˆ
2237
+ 'cannon_fire', // ์บ๋…ผ ๋ฐœ์‚ฌ ์ „์šฉ ํƒ€์ž…
2238
+ player.angle,
2239
+ player
2240
+ ));
2241
+ } else {
2242
+ // ๊ธฐ๊ด€์ด ๋ฐœ์‚ฌ ํšจ๊ณผ
2243
+ effects.push(new Effect(
2244
+ player.x + Math.cos(player.angle) * 30,
2245
+ player.y + Math.sin(player.angle) * 30,
2246
+ 500,
2247
+ 'fire',
2248
+ player.angle,
2249
+ player
2250
+ ));
2251
+ }
2252
+
2253
+ // ์ด์•Œ ์ƒ์„ฑ
2254
  bullets.push({
2255
+ x: muzzleX, // ์ด๊ตฌ ์œ„์น˜์—์„œ ๋ฐœ์‚ฌ
2256
+ y: muzzleY,
2257
  angle: player.angle,
2258
  speed: hasAPCR ? 20 : 10,
2259
  isEnemy: false,
 
2278
  this.offset = { x: Math.cos(angle) * 30, y: Math.sin(angle) * 30 };
2279
  this.img = new Image();
2280
 
2281
+ // ์บ๋…ผ ์ƒท ํšจ๊ณผ๋ฅผ ์œ„ํ•œ ์ถ”๊ฐ€ ์†์„ฑ
2282
+ this.currentShot = 1;
2283
+ this.lastShotChange = Date.now();
2284
+
2285
+ // ๊ฐ ์ƒท๋ณ„ ํฌ๊ธฐ ์ •์˜ (width, height)
2286
+ this.shotSizes = {
2287
+ 1: { width: 40, height: 40 }, // shot1.png - ์ž‘์€ ํ™”์—ผ
2288
+ 2: { width: 60, height: 60 }, // shot2.png - ์ค‘๊ฐ„ ํ™”์—ผ
2289
+ 3: { width: 80, height: 80 } // shot3.png - ํฐ ํ™”์—ผ
2290
+ };
2291
+
2292
  // ์ดํŽ™ํŠธ ํƒ€์ž…์— ๋”ฐ๋ฅธ ์ด๋ฏธ์ง€ ์„ค์ •
2293
  if (type === 'death') {
2294
  this.img.src = 'bang.png';
 
2296
  this.img.src = 'bomb1.png';
2297
  } else if (type === 'hit') {
2298
  this.img.src = 'fire3.png';
2299
+ } else if (type === 'cannon_fire') {
2300
+ this.img.src = 'shot1.png';
2301
+ this.duration = 750; // ์ด 0.75์ดˆ (0.25์ดˆ ร— 3)
2302
+ this.currentSize = this.shotSizes[1]; // ์ดˆ๊ธฐ ํฌ๊ธฐ ์„ค์ •
2303
  } else {
2304
  this.img.src = 'fire2.png';
2305
  }
2306
 
2307
+ // ๊ธฐ๋ณธ ์ดํŽ™ํŠธ ํฌ๊ธฐ ์„ค์ •
2308
+ this.size = type === 'bomb' ? 100 :
2309
  type === 'death' ? 75 :
2310
+ type === 'hit' ? 30 : 42;
2311
+ }
2312
 
2313
  update() {
2314
+ if(this.parent) {
2315
+ if(this.type === 'cannon_fire') {
2316
+ this.x = this.parent.x + Math.cos(this.parent.angle) * (this.parent.width/2);
2317
+ this.y = this.parent.y + Math.sin(this.parent.angle) * (this.parent.width/2);
2318
+ this.angle = this.parent.angle;
2319
+
2320
+ const now = Date.now();
2321
+ const elapsedTime = now - this.startTime;
2322
+
2323
+ // 0.25์ดˆ๋งˆ๋‹ค ์ด๋ฏธ์ง€ ๋ณ€๊ฒฝํ•˜๊ณ , ๋งˆ์ง€๋ง‰ shot3์€ 0.25์ดˆ๋งŒ ์ง€์†
2324
+ if (elapsedTime < 250) {
2325
+ this.currentShot = 1;
2326
+ } else if (elapsedTime < 500) {
2327
+ this.currentShot = 2;
2328
+ } else {
2329
+ this.currentShot = 3;
2330
+ }
2331
+
2332
+ this.img.src = `shot${this.currentShot}.png`;
2333
+ this.currentSize = this.shotSizes[this.currentShot];
2334
+ } else if(this.type === 'fire') {
2335
+ this.x = this.parent.x + this.offset.x;
2336
+ this.y = this.parent.y + this.offset.y;
2337
+ this.angle = this.parent.angle;
2338
+ }
2339
  }
2340
  }
2341