Skip to content

Commit

Permalink
Adjust Creature sprite naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
SushmitaGoswami committed Sep 12, 2024
1 parent b79b1d3 commit 44f934b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public enum CreatureAnimationState {
IDLE,
WALK,
MOVE,
DEAD;

private final String spriteString;
Expand All @@ -16,6 +16,6 @@ public String spriteString() {
}

public CreatureAnimationState getOpposite() {
return this == CreatureAnimationState.IDLE ? WALK : IDLE;
return this == CreatureAnimationState.IDLE ? MOVE : IDLE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* <ul>
* <li>{@link #getSpritePrefix()}-idle-{DIRECTION}.{EXTENSION}
* <li>{@link #getSpritePrefix()}-walk-{DIRECTION}.{EXTENSION}
* <li>{@link #getSpritePrefix()}-move-{DIRECTION}.{EXTENSION}
* </ul>
* <p>
* Where {DIRECTION} refers to a value of the {@link Direction} enum and {@link #getSpritePrefix()} refers to the
Expand Down Expand Up @@ -126,10 +126,10 @@ protected String getCurrentAnimationName() {
return hasAnimation(deadName) ? deadName : chooseRandomDeathAnimation();
} else if (entity.isIdle()) {
String idleName = getIdleSpriteName(direction);
return hasAnimation(idleName) ? idleName : getWalkSpriteName(direction);
return hasAnimation(idleName) ? idleName : getMoveSpriteName(direction);
} else {
String walkName = getWalkSpriteName(direction);
return hasAnimation(walkName) ? walkName : getIdleSpriteName(direction);
String moveName = getMoveSpriteName(direction);
return hasAnimation(moveName) ? moveName : getIdleSpriteName(direction);
}
}

Expand All @@ -152,7 +152,7 @@ private String chooseRandomDeathAnimation() {
}

/**
* Initializes the available animations for the creature. This method sets up walking, idle, and dead animations for all directions.
* Initializes the available animations for the creature. This method sets up moving, idle, and dead animations for all directions.
*/

private void initializeAvailableAnimations() {
Expand Down Expand Up @@ -203,8 +203,8 @@ private String getIdleSpriteName(Direction dir) {
return getSpriteNameWithDirection(CreatureAnimationState.IDLE, dir);
}

private String getWalkSpriteName(Direction dir) {
return getSpriteNameWithDirection(CreatureAnimationState.WALK, dir);
private String getMoveSpriteName(Direction dir) {
return getSpriteNameWithDirection(CreatureAnimationState.MOVE, dir);
}

private String getSpriteNameWithDirection(CreatureAnimationState state, Direction dir) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private static Icon getIcon(Creature creature) {
|| s.getName()
.equals(
CreatureAnimationController.getSpriteName(
creature, CreatureAnimationState.WALK))
creature, CreatureAnimationState.MOVE))
|| s.getName()
.equals(
CreatureAnimationController.getSpriteName(
Expand Down

0 comments on commit 44f934b

Please sign in to comment.