arranged large classes
This commit is contained in:
@@ -50,21 +50,7 @@ public class Entity {
|
||||
this.panel = panel;
|
||||
}
|
||||
|
||||
public void setAction() {}
|
||||
|
||||
public void speak() {
|
||||
if(dialogue[dialogueIndex] == null) dialogueIndex = 0;
|
||||
panel.ui.currentDialogue = dialogue[dialogueIndex];
|
||||
dialogueIndex++;
|
||||
|
||||
switch(panel.player.direction) {
|
||||
case UP -> direction = Direction.DOWN;
|
||||
case DOWN -> direction = Direction.UP;
|
||||
case LEFT -> direction = Direction.RIGHT;
|
||||
case RIGHT -> direction = Direction.LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
// DEFAULT
|
||||
public void update() {
|
||||
setAction();
|
||||
collisionOn = false;
|
||||
@@ -97,7 +83,6 @@ public class Entity {
|
||||
spriteCounter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(Graphics2D graphics2d) {
|
||||
int screenX = worldX - panel.player.worldX + panel.player.screenX;
|
||||
int screenY = worldY - panel.player.worldY + panel.player.screenY;
|
||||
@@ -111,6 +96,22 @@ public class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
// INTERACTION
|
||||
public void speak() {
|
||||
if(dialogue[dialogueIndex] == null) dialogueIndex = 0;
|
||||
panel.ui.currentDialogue = dialogue[dialogueIndex];
|
||||
dialogueIndex++;
|
||||
|
||||
switch(panel.player.direction) {
|
||||
case UP -> direction = Direction.DOWN;
|
||||
case DOWN -> direction = Direction.UP;
|
||||
case LEFT -> direction = Direction.RIGHT;
|
||||
case RIGHT -> direction = Direction.LEFT;
|
||||
}
|
||||
}
|
||||
public void setAction() {}
|
||||
|
||||
// SETTING THINGS UP
|
||||
BufferedImage parseSprite() {
|
||||
return switch (direction) {
|
||||
case UP -> (spriteNum == 1) ? up1 : up2;
|
||||
@@ -119,7 +120,6 @@ public class Entity {
|
||||
case RIGHT -> (spriteNum == 1) ? right1 : right2;
|
||||
};
|
||||
}
|
||||
|
||||
BufferedImage parseSpriteATK() {
|
||||
return switch (direction) {
|
||||
case UP -> (spriteNum == 1) ? attackUp1 : attackUp2;
|
||||
@@ -128,7 +128,6 @@ public class Entity {
|
||||
case RIGHT -> (spriteNum == 1) ? attackRight1 : attackRight2;
|
||||
};
|
||||
}
|
||||
|
||||
public BufferedImage initEntitySprites(String name) {
|
||||
try {
|
||||
return Utility.scaleImage(ImageIO.read(new FileInputStream("assets/" + name + ".png")), panel.tileSize, panel.tileSize);
|
||||
@@ -137,7 +136,6 @@ public class Entity {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public BufferedImage initEntitySprites(String name, int width, int height) {
|
||||
try {
|
||||
return Utility.scaleImage(ImageIO.read(new FileInputStream("assets/" + name + ".png")), width, height);
|
||||
|
||||
Reference in New Issue
Block a user