cutechicken commited on
Commit
e2ece81
·
verified ·
1 Parent(s): 0cbde6f

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +54 -30
index.html CHANGED
@@ -190,22 +190,24 @@
190
  }, 1000);
191
  }
192
 
193
- class Enemy {
194
- constructor(isBoss = false) {
195
- this.x = Math.random() * canvas.width;
196
- this.y = Math.random() * canvas.height;
197
- this.health = isBoss ? 10000 : 1000; // 보스 체력 2배
198
- this.maxHealth = this.health;
199
- this.speed = isBoss ? 1 : 2;
200
- this.lastShot = 0;
201
- this.shootInterval = isBoss ? 1000 : 1000;
202
- this.angle = 0;
203
- this.width = 100;
204
- this.height = 45;
205
- this.moveTimer = 0;
206
- this.moveInterval = Math.random() * 2000 + 1000;
207
- this.moveAngle = Math.random() * Math.PI * 2;
208
- this.isBoss = isBoss;
 
 
209
 
210
  if (isBoss) {
211
  this.enemyImg = new Image();
@@ -239,21 +241,43 @@
239
  }
240
  }
241
 
242
- shoot() {
243
- const sound = this.isBoss ? new Audio('firemn.ogg') : enemyFireSound.cloneNode();
244
- sound.play();
245
-
246
- bullets.push({
247
- x: this.x + Math.cos(this.angle) * 30,
248
- y: this.y + Math.sin(this.angle) * 30,
249
- angle: this.angle,
250
- speed: 5,
251
- isEnemy: true,
252
- size: this.isBoss ? 5 : 3,
253
- damage: this.isBoss ? 300 : 150 // 보스 200 -> 300, 일반 적 100 -> 150으로 강화
254
- });
255
- }
 
 
 
 
 
 
256
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
 
258
  function showShop() {
259
  document.getElementById('shop').style.display = 'block';
 
190
  }, 1000);
191
  }
192
 
193
+ class Enemy {
194
+ constructor(isBoss = false) {
195
+ this.x = Math.random() * canvas.width;
196
+ this.y = Math.random() * canvas.height;
197
+ this.health = isBoss ? 20000 : 1000; // 보스 체력 4배로 증가
198
+ this.maxHealth = this.health;
199
+ this.speed = isBoss ? 1 : 2;
200
+ this.lastShot = 0;
201
+ this.shootInterval = isBoss ? 1000 : 1000;
202
+ this.angle = 0;
203
+ this.width = 100;
204
+ this.height = 45;
205
+ this.moveTimer = 0;
206
+ this.moveInterval = Math.random() * 2000 + 1000;
207
+ this.moveAngle = Math.random() * Math.PI * 2;
208
+ this.isBoss = isBoss;
209
+ }
210
+ }
211
 
212
  if (isBoss) {
213
  this.enemyImg = new Image();
 
241
  }
242
  }
243
 
244
+ shoot() {
245
+ const now = Date.now();
246
+
247
+ // 기관총을 특정 간격마다 섞어서 발사
248
+ if (this.isBoss && now % 3 === 0) { // 조건: 3초마다 기관총 공격
249
+ const sound = new Audio('firemg.ogg'); // 기관총 소리
250
+ sound.play();
251
+
252
+ // 기관총 탄환 5발 발사
253
+ for (let i = -2; i <= 2; i++) { // 총 5발: -2, -1, 0, 1, 2
254
+ const spreadAngle = this.angle + i * 0.1; // 각도 차이를 적용
255
+ bullets.push({
256
+ x: this.x + Math.cos(spreadAngle) * 30,
257
+ y: this.y + Math.sin(spreadAngle) * 30,
258
+ angle: spreadAngle,
259
+ speed: 8, // 기관총 탄환 속도
260
+ isEnemy: true,
261
+ size: 2, // 작은 크기의 탄환
262
+ damage: 50 // 기관총 탄환 피해량
263
+ });
264
  }
265
+ } else {
266
+ // 기존의 기본 공격
267
+ const sound = this.isBoss ? new Audio('firemn.ogg') : enemyFireSound.cloneNode();
268
+ sound.play();
269
+
270
+ bullets.push({
271
+ x: this.x + Math.cos(this.angle) * 30,
272
+ y: this.y + Math.sin(this.angle) * 30,
273
+ angle: this.angle,
274
+ speed: 5,
275
+ isEnemy: true,
276
+ size: this.isBoss ? 5 : 3,
277
+ damage: this.isBoss ? 300 : 150 // 기본 공격 피해량
278
+ });
279
+ }
280
+ }
281
 
282
  function showShop() {
283
  document.getElementById('shop').style.display = 'block';