began working on allies

This commit is contained in:
Harrison Deng 2017-05-29 21:29:42 -05:00
parent 1bc44e0b87
commit 562dbb8117
7 changed files with 97 additions and 8 deletions

View File

@ -1,7 +1,7 @@
package zero1hd.polyjet.entity;
public enum Entities {
POLYJET, BAR_BEAT, VOID_CIRCLE, SHARDS;
POLYJET, BAR_BEAT, VOID_CIRCLE, SHARDS, LASER;
public float x;
public float y;

View File

@ -0,0 +1,67 @@
package zero1hd.polyjet.entity.ally;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Pool.Poolable;
import zero1hd.polyjet.entity.Entities;
import zero1hd.polyjet.entity.Entity;
public class Laser extends Actor implements Entity, Poolable {
private Rectangle hitBox;
private float rate;
Texture laserTexture;
public Laser(Texture laserTexture) {
this.laserTexture = laserTexture;
}
public void init(float x, float y, float rate) {
setX(x);
setY(y);
this.rate = rate;
setSize(0.25f, 2f);
hitBox = new Rectangle();
hitBox.setSize(getWidth(), getHeight());
}
@Override
public void act(float delta) {
moveBy(0, delta*rate);
hitBox.setX(getX());
hitBox.setY(getY());
super.act(delta);
}
@Override
public void draw(Batch batch, float parentAlpha) {
batch.draw(laserTexture ,getX(), getY(), getWidth(), getHeight());
super.draw(batch, parentAlpha);
}
@Override
public void reset() {
setX(0);
setY(0);
setSize(0, 0);
rate = 0;
hitBox.set(0, 0, 0, 0);
}
@Override
public void collided(Entity entity) {
}
@Override
public Rectangle getHitZone() {
return hitBox;
}
@Override
public Entities getEntityType() {
return Entities.LASER;
}
}

View File

@ -1,4 +1,4 @@
package zero1hd.polyjet.entity;
package zero1hd.polyjet.entity.ally;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
@ -8,6 +8,8 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import zero1hd.polyjet.Polyjet;
import zero1hd.polyjet.entity.Entities;
import zero1hd.polyjet.entity.Entity;
public class PolyJetEntity extends Actor implements Entity {

View File

@ -0,0 +1,5 @@
package zero1hd.polyjet.entity.boxes;
public class BoxOfAllies {
}

View File

@ -1,15 +1,27 @@
package zero1hd.polyjet.entity;
package zero1hd.polyjet.entity.boxes;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool;
import com.badlogic.gdx.utils.Pools;
import zero1hd.polyjet.entity.Entities;
import zero1hd.polyjet.entity.Entity;
import zero1hd.polyjet.entity.enemies.VoidCircle;
public class BoxOfEnemies {
private final Pool<VoidCircle> voidCirclePool = Pools.get(VoidCircle.class);
private final Array<Entity> ActiveEnemies;
public BoxOfEnemies() {
private final Pool<VoidCircle> voidCirclePool;
public BoxOfEnemies(final ShapeRenderer shapeRenderer) {
ActiveEnemies = new Array<Entity>();
voidCirclePool = new Pool<VoidCircle>() {
@Override
protected VoidCircle newObject() {
return new VoidCircle(shapeRenderer);
}
};
}
public Entity getEntity(Entities entity) {

View File

@ -1,4 +1,4 @@
package zero1hd.polyjet.entity;
package zero1hd.polyjet.entity.enemies;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
@ -8,6 +8,9 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.utils.Pool.Poolable;
import zero1hd.polyjet.entity.Entities;
import zero1hd.polyjet.entity.Entity;
public class VoidCircle extends Actor implements Entity, Poolable {
float timer;
float endRadius;

View File

@ -6,7 +6,7 @@ import com.badlogic.gdx.utils.viewport.FitViewport;
import zero1hd.polyjet.Polyjet;
import zero1hd.polyjet.controls.KeyMap;
import zero1hd.polyjet.entity.PolyJetEntity;
import zero1hd.polyjet.entity.ally.PolyJetEntity;
public class GamePlayArea extends Stage {