diff --git a/GamePlay/Entities/Character.java b/GamePlay/Entities/Character.java new file mode 100644 index 0000000..f4d2366 --- /dev/null +++ b/GamePlay/Entities/Character.java @@ -0,0 +1,31 @@ +package Entities; + +import Frames.Frame; + +/** + * Character class, which is a sub-class of an entity + * @author Victor + * + */ +public class Character extends Entity { + private static int maxHP; + + /** + * Main constructor for a character. By default its max health is 1000 if not specified + */ + public Character() { + super(); + this.maxHP = 1000; + } + + public Character(int posx, int posy, Frame f, int maxHP) { + super(posx, posy, f); + this.maxHP = maxHP; + } + + public void setMaxHP(int HP) { + this.maxHP = HP; + } + + public int getMaxHP() { return this.getMaxHP();} +} diff --git a/GamePlay/Entities/Entity.java b/GamePlay/Entities/Entity.java index 5e254f3..0ddf6c6 100644 --- a/GamePlay/Entities/Entity.java +++ b/GamePlay/Entities/Entity.java @@ -1,5 +1,7 @@ package Entities; +import Frames.Frame; + /** * Entity class, which is the main class regrouping characters and projectiles * @author Victor @@ -8,5 +10,41 @@ package Entities; public class Entity { private int posx; private int posy; - private .Frame currentFrame = new Entityframe(); + private Frame currentFrame; + + /** + * base constructor of the entity class + */ + public Entity() { + this.posx = 0; + this.posy = 0; + this.currentFrame = new Frame(); + } + + /** + * constructor of the entity class with parameters + * @param posx the position of the entity on the x axis + * @param posy the position of the entity on the y axis + * @param f the current frame of the new entity + */ + public Entity(int posx, int posy, Frame f) { + this.posx = posx; + this.posy = posy; + this.currentFrame = f; + } + + public void setPos(int x, int y) { + this.posx = x; + this.posy = y; + } + + public void setCurrentFrame(Frame f) { + this.currentFrame = f; + } + + public int getPosX() {return this.posx;} + + public int getPosY() {return this.posy;} + + public Frame getCurrentframe() {return this.currentFrame;} }