began work adding pellet entity

This commit is contained in:
2017-06-01 17:59:05 -05:00
parent 4e818e2752
commit 529031fd07
69 changed files with 105 additions and 10 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.Pellet;
import zero1hd.polyjet.entity.enemies.VoidCircle;
public class EntityController {
@@ -17,6 +18,7 @@ public class EntityController {
public Array<Entity> activeEnemies;
//Enemy pool declaration;
private Pool<VoidCircle> voidCirclePool;
private Pool<Pellet> pelletPool;
//Ally pool declaration;
private Pool<Laser> laserPool;
@@ -35,6 +37,12 @@ public class EntityController {
return new VoidCircle(shapes);
}
};
pelletPool = new Pool<Pellet>() {
@Override
protected Pellet newObject() {
return new Pellet(assets.get("pellet.png", Texture.class));
}
};
//Ally pool initialization;
laserPool = new Pool<Laser>() {
@@ -52,14 +60,14 @@ public class EntityController {
VoidCircle voidCircle = voidCirclePool.obtain();
activeEnemies.add(voidCircle);
return voidCircle;
case BAR_BEAT:
return null;
case SHARDS:
return null;
case LASER:
Laser laser = laserPool.obtain();
activeAllies.add(laser);
return laser;
case PELLET:
Pellet pellet = pelletPool.obtain();
activeEnemies.add(pellet);
return pellet;
default:
return null;
}
@@ -67,10 +75,6 @@ public class EntityController {
public void free(Entity entity) {
switch (entity.getEntityType()) {
case BAR_BEAT:
break;
case SHARDS:
break;
case VOID_CIRCLE:
VoidCircle voidCircle = (VoidCircle) entity;
voidCircle.remove();
@@ -83,6 +87,11 @@ public class EntityController {
activeAllies.removeValue(entity, true);
laserPool.free(laser);
break;
case PELLET:
Pellet pellet = (Pellet) entity;
pellet.remove();
activeEnemies.removeValue(entity, true);
pelletPool.free(pellet);
default:
break;
}