cleaning for beginning of physics implementation
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
package zero1hd.polyjet.entity;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
import com.badlogic.gdx.graphics.g2d.NinePatch;
|
||||
|
||||
import zero1hd.polyjet.Polyjet;
|
||||
|
||||
public class BarBeat extends Entity {
|
||||
NinePatch texture;
|
||||
float rate;
|
||||
|
||||
public void initiate(float size, float rate, float spawnX, float spawnY, NinePatch texture) {
|
||||
hitpoints = 1;
|
||||
this.rate = rate;
|
||||
setPosition(spawnX, spawnY);
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
if (getY() + getHeight() < Polyjet.GAME_AREA_HEIGHT) {
|
||||
hitpoints = 0;
|
||||
}
|
||||
moveBy(0, -rate*delta);
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
texture.draw(batch, getX(), getY(), getWidth(), getHeight());
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamageDealt() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
texture = null;
|
||||
super.reset();
|
||||
}
|
||||
}
|
@@ -2,4 +2,8 @@ package zero1hd.polyjet.entity;
|
||||
|
||||
public enum Entities {
|
||||
Bar_Beat, Void_Circle;
|
||||
|
||||
public float x;
|
||||
public float y;
|
||||
public float velocity;
|
||||
}
|
||||
|
@@ -1,71 +0,0 @@
|
||||
package zero1hd.polyjet.entity;
|
||||
|
||||
import com.badlogic.gdx.math.Rectangle;
|
||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||
import com.badlogic.gdx.utils.Pool.Poolable;
|
||||
|
||||
public class Entity extends Actor implements Poolable {
|
||||
private Rectangle hitbox;
|
||||
protected int hitpoints;
|
||||
|
||||
public Entity() {
|
||||
hitbox = new Rectangle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSize(float width, float height) {
|
||||
hitbox.setSize(width, height);
|
||||
super.setSize(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
hitbox.setPosition(getX(), getY());
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return amount of hp this entity has left.
|
||||
*/
|
||||
public int getHitPoints() {
|
||||
return hitpoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* used as a hitbox.
|
||||
* @return a rectangle used for hit detection
|
||||
*/
|
||||
public Rectangle getHitbox() {
|
||||
return hitbox;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 0 if not overridden.
|
||||
* @return the amount of damage dealt.
|
||||
*/
|
||||
public int getDamageDealt() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Doesn't do anything if not overridden.
|
||||
* @param damageToDeal the amount of damage to deal to this entity.
|
||||
*/
|
||||
public void dealDamage(int damageToDeal) {
|
||||
}
|
||||
/**
|
||||
* Default value is 0 if not overridden and setup properly.
|
||||
* Note: this method is called whether or not this entity is dead. whenever two entities cross, this will be called.
|
||||
* @return the amount of points this entity is worth
|
||||
*/
|
||||
public int getPoints() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
setPosition(0, 0);
|
||||
setSize(0, 0);
|
||||
hitpoints = 0;
|
||||
}
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
package zero1hd.polyjet.entity;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
import com.badlogic.gdx.graphics.g2d.Batch;
|
||||
|
||||
import zero1hd.polyjet.Polyjet;
|
||||
|
||||
public class Projectile extends Entity {
|
||||
float rate;
|
||||
int damage;
|
||||
Texture texture;
|
||||
int hp;
|
||||
int storedPoints;
|
||||
|
||||
public Projectile() {
|
||||
super();
|
||||
Gdx.app.debug("Projectile", "A new projectile was created.");
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param spawnX x spawn location
|
||||
* @param spawnY y spawn location
|
||||
* @param rate r/second
|
||||
* @param hp health this projectile should have
|
||||
* @param texture texture this projectile should render.
|
||||
*/
|
||||
public void initiate(float spawnX, float spawnY, float rate, int hp, Texture texture, float width, float height) {
|
||||
this.hp = hp;
|
||||
setX(spawnX);
|
||||
setY(spawnY);
|
||||
this.texture = texture;
|
||||
this.rate = rate;
|
||||
setSize(width, height);
|
||||
damage = 1;
|
||||
}
|
||||
|
||||
public void setDamage(int damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
public void printDebug() {
|
||||
Gdx.app.debug("Projectile", "Coordinates (X,Y): (" + getX() + ", " + getY() + ") Current parent: " + getParent().getName());
|
||||
Gdx.app.debug("Projectile", "Width and height: " + getWidth() + "x" + getHeight());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void act(float delta) {
|
||||
moveBy(0, delta*rate);
|
||||
if (getY() > Polyjet.GAME_AREA_HEIGHT) {
|
||||
hp = 0;
|
||||
}
|
||||
super.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Batch batch, float parentAlpha) {
|
||||
batch.draw(texture, getX(), getY(), getWidth(), getHeight());
|
||||
super.draw(batch, parentAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
texture = null;
|
||||
storedPoints = 0;
|
||||
rate = 0;
|
||||
damage = 0;
|
||||
setDebug(false);
|
||||
}
|
||||
@Override
|
||||
public int getHitPoints() {
|
||||
return hp;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user