forked from jzitnik/twodcraft
26 lines
638 B
Java
26 lines
638 B
Java
package cz.jzitnik.game.sprites;
|
|
|
|
import cz.jzitnik.tui.ResourceLoader;
|
|
import cz.jzitnik.tui.Sprite;
|
|
|
|
public class Pig extends Sprite {
|
|
public enum PigState{
|
|
LEFT,
|
|
RIGHT,
|
|
}
|
|
|
|
public String getSprite() {
|
|
return getSprite(PigState.RIGHT);
|
|
}
|
|
|
|
public String getSprite(Enum e) {
|
|
return ResourceLoader.loadResource(
|
|
switch (e) {
|
|
case PigState.LEFT -> "mobs/pigrev.ans";
|
|
case PigState.RIGHT -> "mobs/pig.ans";
|
|
default -> throw new IllegalStateException("Unexpected value: " + e);
|
|
}
|
|
);
|
|
}
|
|
}
|