cutechicken commited on
Commit
b95f0f2
ยท
verified ยท
1 Parent(s): 16ff3fa

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +51 -0
index.html CHANGED
@@ -278,6 +278,7 @@
278
  let allyUnits = [];
279
  let lastSupportSpawn = 0;
280
  let gameStarted = false;
 
281
  //๊ฒฝ๊ณ  ์‹œ์Šคํ…œ ๊ณ„์Šน
282
  let warningLines = [];
283
  let spitfires = [];
@@ -1594,6 +1595,13 @@ bullets = bullets.filter(bullet => {
1594
  500,
1595
  'hit'
1596
  ));
 
 
 
 
 
 
 
1597
 
1598
  // ๋ฐ๋ฏธ์ง€ ์ฆ๊ฐ€
1599
  let damage = currentWeapon === 'cannon' ? 1000 : 150; // ๊ธฐ์กด 250๊ณผ 50 ๋Œ€๋น„ ์ƒ๋‹น๋Ÿ‰ ์ฆ๊ฐ€
@@ -1803,6 +1811,13 @@ bullets = bullets.filter(bullet => {
1803
  ctx.fillText(`Stage ${currentStage} - Round ${currentRound}/${currentStage === 3 ? 20 : 10}`, 10, 30);
1804
  ctx.fillText(`Gold: ${gold}`, 10, 60);
1805
 
 
 
 
 
 
 
 
1806
  // ์ดํŽ™ํŠธ ๊ทธ๋ฆฌ๊ธฐ
1807
  effects = effects.filter(effect => !effect.isExpired());
1808
  effects.forEach(effect => {
@@ -2268,7 +2283,42 @@ function fireBullet() {
2268
  lastShot = now;
2269
  }
2270
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2272
  // Effect ํด๋ž˜์Šค
2273
  class Effect {
2274
  constructor(x, y, duration, type, angle = 0, parent = null) {
@@ -2347,6 +2397,7 @@ class Effect {
2347
  return Date.now() - this.startTime > this.duration;
2348
  }
2349
  }
 
2350
  </script>
2351
  </body>
2352
  </html>
 
278
  let allyUnits = [];
279
  let lastSupportSpawn = 0;
280
  let gameStarted = false;
281
+ let textEffects = []; // ํ…์ŠคํŠธ ์ดํŽ™ํŠธ ๋ฐฐ์—ด ์ถ”๊ฐ€
282
  //๊ฒฝ๊ณ  ์‹œ์Šคํ…œ ๊ณ„์Šน
283
  let warningLines = [];
284
  let spitfires = [];
 
1595
  500,
1596
  'hit'
1597
  ));
1598
+ // HIT! ํ…์ŠคํŠธ ์ดํŽ™ํŠธ ์ถ”๊ฐ€
1599
+ textEffects.push(new TextEffect(
1600
+ enemy.x,
1601
+ enemy.y - 30,
1602
+ "HIT!",
1603
+ "#00ff00"
1604
+ ));
1605
 
1606
  // ๋ฐ๋ฏธ์ง€ ์ฆ๊ฐ€
1607
  let damage = currentWeapon === 'cannon' ? 1000 : 150; // ๊ธฐ์กด 250๊ณผ 50 ๋Œ€๋น„ ์ƒ๋‹น๋Ÿ‰ ์ฆ๊ฐ€
 
1811
  ctx.fillText(`Stage ${currentStage} - Round ${currentRound}/${currentStage === 3 ? 20 : 10}`, 10, 30);
1812
  ctx.fillText(`Gold: ${gold}`, 10, 60);
1813
 
1814
+ // ํ…์ŠคํŠธ ์ดํŽ™ํŠธ ์—…๋ฐ์ดํŠธ ๋ฐ ๊ทธ๋ฆฌ๊ธฐ
1815
+ textEffects = textEffects.filter(effect => !effect.isExpired());
1816
+ textEffects.forEach(effect => {
1817
+ effect.update();
1818
+ effect.draw(ctx);
1819
+ });
1820
+
1821
  // ์ดํŽ™ํŠธ ๊ทธ๋ฆฌ๊ธฐ
1822
  effects = effects.filter(effect => !effect.isExpired());
1823
  effects.forEach(effect => {
 
2283
  lastShot = now;
2284
  }
2285
  }
2286
+ class TextEffect {
2287
+ constructor(x, y, text, color, duration = 1000) {
2288
+ this.x = x;
2289
+ this.y = y;
2290
+ this.text = text;
2291
+ this.color = color;
2292
+ this.startTime = Date.now();
2293
+ this.duration = duration;
2294
+ this.fadeOut = 0.5; // ํŽ˜์ด๋“œ์•„์›ƒ ์‹œ์ž‘ ์‹œ์  (0.5 = 50% ์‹œ์ ๋ถ€ํ„ฐ)
2295
+ this.initialY = y;
2296
+ this.speed = -1; // ์œ„๋กœ ์˜ฌ๋ผ๊ฐ€๋Š” ์†๋„
2297
+ }
2298
+
2299
+ update() {
2300
+ const elapsed = (Date.now() - this.startTime) / this.duration;
2301
+ this.y = this.initialY + (this.speed * elapsed * 50); // ์œ„๋กœ ์˜ฌ๋ผ๊ฐ€๋Š” ํšจ๊ณผ
2302
+ }
2303
 
2304
+ draw(ctx) {
2305
+ const elapsed = (Date.now() - this.startTime) / this.duration;
2306
+ const opacity = elapsed > this.fadeOut ?
2307
+ 1 - ((elapsed - this.fadeOut) / (1 - this.fadeOut)) : 1;
2308
+
2309
+ ctx.save();
2310
+ ctx.fillStyle = this.color;
2311
+ ctx.globalAlpha = opacity;
2312
+ ctx.font = 'bold 20px Arial';
2313
+ ctx.textAlign = 'center';
2314
+ ctx.fillText(this.text, this.x, this.y);
2315
+ ctx.restore();
2316
+ }
2317
+
2318
+ isExpired() {
2319
+ return Date.now() - this.startTime > this.duration;
2320
+ }
2321
+ }
2322
  // Effect ํด๋ž˜์Šค
2323
  class Effect {
2324
  constructor(x, y, duration, type, angle = 0, parent = null) {
 
2397
  return Date.now() - this.startTime > this.duration;
2398
  }
2399
  }
2400
+
2401
  </script>
2402
  </body>
2403
  </html>