Spaces:
Running
Running
Update index.html
Browse files- 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>
|