Skip to content

Commit

Permalink
밸런스 패치
Browse files Browse the repository at this point in the history
  • Loading branch information
sadie100 committed Aug 25, 2024
1 parent 89b9e1e commit 45a42ad
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 61 deletions.
2 changes: 1 addition & 1 deletion src/scenes/BaseScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export class BaseScene extends Scene {
}

setNextHeartSpawnTime() {
const randomDelay = Phaser.Math.Between(10000, 20000); // 10초에서 20초 사이의 랜덤한 시간
const randomDelay = Phaser.Math.Between(10000, 15000); // 10초에서 20초 사이의 랜덤한 시간
this.lastHeartSpawnTime = this.time.now + randomDelay;
}

Expand Down
26 changes: 26 additions & 0 deletions src/scenes/BossScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ export class BossScene extends BaseScene {
super.create();

this.spawnBossMonster();

// 게임 시간 및 난이도 조절을 위한 타이머
this.time.addEvent({
delay: 1000, // 1초마다
callback: this.updateGameTime,
callbackScope: this,
loop: true,
});
}

updateGameTime() {
this.gameTime += 1000;
this.elapsedSeconds = Math.floor(this.gameTime / 1000);

// HudScene의 시간 업데이트
if (this.hudScene) {
this.hudScene.updateTime(this.elapsedSeconds);
}

// Heart spawn logic
if (
this.isHeartSpawnTimerRunning &&
this.time.now >= this.lastHeartSpawnTime
) {
this.spawnHeart();
}
}

setupCollisionsWithBullets(bullets) {
Expand Down
29 changes: 1 addition & 28 deletions src/scenes/FirstScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,7 @@ export class FirstScene extends NormalScene {
}

spawnSingleMonster() {
let x, y, direction;

if (this.gameTime >= this.advancedSpawnTime) {
const spawnArea = Math.random();
if (spawnArea < 0.6) {
x = this.scale.width;
y = Phaser.Math.Between(0, this.scale.height);
direction = "straight";
} else if (spawnArea < 0.8) {
x = Phaser.Math.Between(
this.scale.width * 0.7,
this.scale.width
);
y = 0;
direction = "down";
} else {
x = Phaser.Math.Between(
this.scale.width * 0.7,
this.scale.width
);
y = this.scale.height;
direction = "up";
}
} else {
x = this.scale.width;
y = Phaser.Math.Between(0, this.scale.height);
direction = "straight";
}
const { x, y, direction } = this.getSpawnPosition();

const pig = new Pig(this, x, y, this.currentMonsterSpeed, direction);
this.monsters.add(pig);
Expand Down
51 changes: 47 additions & 4 deletions src/scenes/NormalScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ export class NormalScene extends BaseScene {
currentMonsterSpeed = 150; // 현재 속도도 150으로 초기화
monsterSpeedIncreaseRate = 5;

middleSpawnTime = 20000; // 20초 후 중급 스폰 시작
updownSpawnTime = 30000; // 30초 후 맵 위 아래 스폰 시작
// 고급 스폰 시스템
advancedSpawnTime = 30000; // 30초 후 고급 스폰 시작
advancedSpawnTime = 40000; // 40초 후 고급 스폰 시작
monstersPerSpawn = 1;

//라운드 종료
Expand Down Expand Up @@ -144,6 +146,17 @@ export class NormalScene extends BaseScene {
// 몬스터 속도 증가
this.currentMonsterSpeed += this.monsterSpeedIncreaseRate;

// 중급 스폰 시스템
if (
this.gameTime >= this.middleSpawnTime &&
this.monstersPerSpawn < 3
) {
this.monstersPerSpawn = Math.min(
3,
this.monstersPerSpawn +
Math.floor((this.gameTime - this.middleSpawnTime) / 10)
);
}
// 고급 스폰 시스템
if (
this.gameTime >= this.advancedSpawnTime &&
Expand All @@ -167,10 +180,40 @@ export class NormalScene extends BaseScene {
}
}

spawnSingleMonster() {
// 자식 클래스에서 구현
}
getSpawnPosition() {
let x, y, direction;

if (this.gameTime >= this.advancedSpawnTime) {
return this.getSpecialSpawnPosition(this.scale.width * 0.3);
} else if (this.gameTime >= this.updownSpawnTime) {
return this.getSpecialSpawnPosition(this.scale.width * 0.7);
} else {
x = this.scale.width;
y = Phaser.Math.Between(0, this.scale.height);
direction = "straight";
}

return { x, y, direction };
}

getSpecialSpawnPosition(widthBound) {
let x, y, direction;
const spawnArea = Math.random();
if (spawnArea < 0.6) {
x = this.scale.width;
y = Phaser.Math.Between(0, this.scale.height);
direction = "straight";
} else if (spawnArea < 0.8) {
x = Phaser.Math.Between(widthBound, this.scale.width);
y = 0;
direction = "down";
} else {
x = Phaser.Math.Between(widthBound, this.scale.width);
y = this.scale.height;
direction = "up";
}
return { x, y, direction };
}
hitMonster(egg, monster) {
console.log("Egg hit monster. Damage:", egg.damage);
monster.hit(egg.damage);
Expand Down
29 changes: 1 addition & 28 deletions src/scenes/SecondScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,7 @@ export class SecondScene extends NormalScene {
}

spawnSingleMonster() {
let x, y, direction;

if (this.gameTime >= this.advancedSpawnTime) {
const spawnArea = Math.random();
if (spawnArea < 0.6) {
x = this.scale.width;
y = Phaser.Math.Between(0, this.scale.height);
direction = "straight";
} else if (spawnArea < 0.8) {
x = Phaser.Math.Between(
this.scale.width * 0.7,
this.scale.width
);
y = 0;
direction = "down";
} else {
x = Phaser.Math.Between(
this.scale.width * 0.7,
this.scale.width
);
y = this.scale.height;
direction = "up";
}
} else {
x = this.scale.width;
y = Phaser.Math.Between(0, this.scale.height);
direction = "straight";
}
const { x, y, direction } = this.getSpawnPosition();

if (Math.random() < 0.3) {
// 30% 확률로 고양이 스폰
Expand Down

0 comments on commit 45a42ad

Please sign in to comment.