Spaces:
Running
Running
Update index.html
Browse files- index.html +41 -38
index.html
CHANGED
@@ -184,32 +184,33 @@
|
|
184 |
}, 1000);
|
185 |
}
|
186 |
class Enemy {
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
213 |
update() {
|
214 |
if(isCountingDown) return;
|
215 |
const now = Date.now();
|
@@ -229,18 +230,20 @@
|
|
229 |
this.lastShot = now;
|
230 |
}
|
231 |
}
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
|
|
|
|
244 |
}
|
245 |
function showShop() {
|
246 |
document.getElementById('shop').style.display = 'block';
|
|
|
184 |
}, 1000);
|
185 |
}
|
186 |
class Enemy {
|
187 |
+
constructor(isBoss = false) {
|
188 |
+
this.x = Math.random() * canvas.width;
|
189 |
+
this.y = Math.random() * canvas.height;
|
190 |
+
this.health = isBoss ? 10000 : 1000; // 보스 체력 2배
|
191 |
+
this.maxHealth = this.health;
|
192 |
+
this.speed = isBoss ? 1 : 2;
|
193 |
+
this.lastShot = 0;
|
194 |
+
this.shootInterval = isBoss ? 1000 : 1000;
|
195 |
+
this.angle = 0;
|
196 |
+
this.width = 100;
|
197 |
+
this.height = 45;
|
198 |
+
this.moveTimer = 0;
|
199 |
+
this.moveInterval = Math.random() * 2000 + 1000;
|
200 |
+
this.moveAngle = Math.random() * Math.PI * 2;
|
201 |
+
this.isBoss = isBoss;
|
202 |
+
|
203 |
+
if (isBoss) {
|
204 |
+
this.enemyImg = new Image();
|
205 |
+
this.enemyImg.src = 'boss.png';
|
206 |
+
} else if (currentRound >= 7) {
|
207 |
+
this.enemyImg = new Image();
|
208 |
+
this.enemyImg.src = 'enemy3.png';
|
209 |
+
} else if (currentRound >= 4) {
|
210 |
+
this.enemyImg = new Image();
|
211 |
+
this.enemyImg.src = 'enemy2.png';
|
212 |
+
}
|
213 |
+
}
|
214 |
update() {
|
215 |
if(isCountingDown) return;
|
216 |
const now = Date.now();
|
|
|
230 |
this.lastShot = now;
|
231 |
}
|
232 |
}
|
233 |
+
shoot() {
|
234 |
+
const sound = this.isBoss ? new Audio('firemn.ogg') : enemyFireSound.cloneNode();
|
235 |
+
sound.play();
|
236 |
+
|
237 |
+
bullets.push({
|
238 |
+
x: this.x + Math.cos(this.angle) * 30,
|
239 |
+
y: this.y + Math.sin(this.angle) * 30,
|
240 |
+
angle: this.angle,
|
241 |
+
speed: 5,
|
242 |
+
isEnemy: true,
|
243 |
+
size: this.isBoss ? 5 : 3,
|
244 |
+
damage: this.isBoss ? 300 : 150 // 보스 200 -> 300, 일반 적 100 -> 150으로 강화
|
245 |
+
});
|
246 |
+
}
|
247 |
}
|
248 |
function showShop() {
|
249 |
document.getElementById('shop').style.display = 'block';
|