Skip to content

Commit

Permalink
added demon and slime death cases in the sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
gregchan550 committed Sep 22, 2023
1 parent 2fdd0d9 commit 6168360
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ public void update() {
// detect death stage
if (health <= 0 && !slimeFlag) {
slimeFlag = true;
changeState(DemonState.DEATH);
changeState(DemonState.TRANSFORM_REVERSE);
demon.getComponent(CombatStatsComponent.class).addHealth(500);
} else if (health <= 0 && slimeFlag) {
changeState(DemonState.TRANSFORM);
}

// detect half health
Expand Down Expand Up @@ -178,7 +180,14 @@ public void update() {
changeState(DemonState.IDLE);
}
}
case DEATH -> {
case TRANSFORM -> {
if (health <= 0) {
if (animation.isFinished()) {
changeState(DemonState.DEATH);
}
}
}
case TRANSFORM_REVERSE -> {
if (animation.isFinished()) {
changeState(DemonState.SLIME_MOVE);
}
Expand All @@ -195,6 +204,11 @@ public void update() {
}
}
}
case DEATH -> {
if (animation.isFinished()) {
demon.dispose();
}
}
}
}

Expand Down

0 comments on commit 6168360

Please sign in to comment.