slime runs away when it gets hit
This commit is contained in:
@@ -15,7 +15,7 @@ import java.util.logging.Level;
|
||||
|
||||
public class Entity {
|
||||
|
||||
GamePanel panel;
|
||||
protected GamePanel panel;
|
||||
public BufferedImage up1, up2, down1, down2, left1, left2, right1, right2;
|
||||
public BufferedImage attackUp1, attackUp2, attackDown1, attackDown2, attackLeft1, attackLeft2, attackRight1, attackRight2;
|
||||
public BufferedImage image, image2, image3;
|
||||
@@ -142,6 +142,7 @@ public class Entity {
|
||||
|
||||
// INTERACTION
|
||||
public void setAction() {}
|
||||
public void damageReaction() {};
|
||||
public void speak() {
|
||||
if(dialogue[dialogueIndex] == null) dialogueIndex = 0;
|
||||
panel.ui.currentDialogue = dialogue[dialogueIndex];
|
||||
|
||||
@@ -155,6 +155,7 @@ public class Player extends Entity {
|
||||
panel.monster[index].life -= 1;
|
||||
panel.playSE(5);
|
||||
panel.monster[index].invincible = true;
|
||||
panel.monster[index].damageReaction();
|
||||
if(panel.monster[index].life <= 0) panel.monster[index].dying = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@ public class GreenSlimeMON extends Entity {
|
||||
if(i > 75) direction = Direction.RIGHT;
|
||||
actionLock = 0;
|
||||
}
|
||||
public void damageReaction() {
|
||||
actionLock = 0;
|
||||
direction = panel.player.direction;
|
||||
}
|
||||
|
||||
// SETTING THINGS UP
|
||||
public void getImage() {
|
||||
|
||||
Reference in New Issue
Block a user