added bar entity

This commit is contained in:
2017-06-03 00:24:56 -05:00
parent 4a51156759
commit 53ff7109b2
15 changed files with 111 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool;
import zero1hd.polyjet.entity.ally.Laser;
import zero1hd.polyjet.entity.enemies.Bar;
import zero1hd.polyjet.entity.enemies.Pellet;
import zero1hd.polyjet.entity.enemies.Shard;
import zero1hd.polyjet.entity.enemies.VoidCircle;
@@ -17,10 +18,12 @@ public class EntityController {
public Array<Entity> activeAllies;
public Array<Entity> activeEnemies;
//Enemy pool declaration;
private Pool<VoidCircle> voidCirclePool;
private Pool<Pellet> pelletPool;
private Pool<Shard> shardPool;
private Pool<Bar> barPool;
//Ally pool declaration;
private Pool<Laser> laserPool;
@@ -51,6 +54,12 @@ public class EntityController {
return new Shard(assets.get("shard.png", Texture.class));
}
};
barPool = new Pool<Bar>() {
@Override
protected Bar newObject() {
return new Bar(assets.get("bar.png", Texture.class));
}
};
//Ally pool initialization;
laserPool = new Pool<Laser>() {
@@ -80,6 +89,10 @@ public class EntityController {
Shard shard = shardPool.obtain();
activeEnemies.add(shard);
return shard;
case BAR:
Bar bar = barPool.obtain();
activeEnemies.add(bar);
return bar;
default:
return null;
}
@@ -111,6 +124,11 @@ public class EntityController {
activeEnemies.removeValue(entity, true);
shardPool.free(shard);
break;
case BAR:
Bar bar = (Bar) entity;
bar.remove();
activeEnemies.removeValue(entity, true);
barPool.free(bar);
default:
break;
}