added more comments, attempt at fixing visual glitch with flake entity
This commit is contained in:
parent
7cdb372de2
commit
688c1acf96
@ -28,8 +28,8 @@ public class Entity extends Actor implements Poolable {
|
|||||||
protected boolean simple = true;
|
protected boolean simple = true;
|
||||||
protected boolean nonStnrd = false;
|
protected boolean nonStnrd = false;
|
||||||
protected boolean move = true;
|
protected boolean move = true;
|
||||||
protected boolean dead;
|
|
||||||
|
|
||||||
|
protected boolean dead;
|
||||||
protected Rectangle hitbox;
|
protected Rectangle hitbox;
|
||||||
protected Sprite sprite;
|
protected Sprite sprite;
|
||||||
protected Vector2 rotRatios;
|
protected Vector2 rotRatios;
|
||||||
@ -41,6 +41,10 @@ public class Entity extends Actor implements Poolable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* called by the entity frame and only once (when this object is created).
|
* called by the entity frame and only once (when this object is created).
|
||||||
|
* Used by the frame to setup variables for simple calling later.
|
||||||
|
* Anything that needs to be setup for the entity on first call should not override this.
|
||||||
|
* (Unless you call the super of this and then the rest which is fine too).
|
||||||
|
* This will then call preInit() which is the method you should override.
|
||||||
*/
|
*/
|
||||||
protected void setup(EntityManager ec, EntityFrame<?> ef) {
|
protected void setup(EntityManager ec, EntityFrame<?> ef) {
|
||||||
this.ec = ec;
|
this.ec = ec;
|
||||||
@ -54,11 +58,18 @@ public class Entity extends Actor implements Poolable {
|
|||||||
preInit();
|
preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to override should any setup need to be done once (on entity first creation).
|
||||||
|
*/
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
if (sprite.getTexture() == null) throw new NullPointerException("what, your not going to have a texture for your entity?");
|
if (sprite.getTexture() == null) throw new NullPointerException("what, your not going to have a texture for your entity?");
|
||||||
sprite.setOriginCenter();
|
sprite.setOriginCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used by the game stage to pass parameters for different types of entities.
|
||||||
|
* @param params a hashmap containing parameters necessary for different entities.
|
||||||
|
*/
|
||||||
public void init(HashMap<String, Float> params) {
|
public void init(HashMap<String, Float> params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ public class Flake extends Entity {
|
|||||||
enemy = true;
|
enemy = true;
|
||||||
move = false;
|
move = false;
|
||||||
setSize(3f, 3f);
|
setSize(3f, 3f);
|
||||||
|
sprite.setSize(getWidth(), getHeight());
|
||||||
super.preInit();
|
super.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ public class Shard extends Entity {
|
|||||||
maxHp = hp;
|
maxHp = hp;
|
||||||
this.angle = angle;
|
this.angle = angle;
|
||||||
setPosition(x-(getWidth()/2f), y-(getHeight()/2f));
|
setPosition(x-(getWidth()/2f), y-(getHeight()/2f));
|
||||||
hitbox.setSize(getWidth(), getHeight());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user