Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust Creature sprite naming conventions #839

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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