Clean Codeers Club checkout

This commit is contained in:
Allexit 2015-05-10 17:57:50 +03:00
parent 543ef101e3
commit ed2b09fa57

View File

@ -31,30 +31,20 @@ public class GladiatorBrawler extends ApplicationAdapter {
engine = new Engine(); engine = new Engine();
engine.addSystem(new PhysicsSystem()); engine.addSystem(new PhysicsSystem());
engine.addSystem(new RenderingSystem());
engine.addEntityListener(new EntityListener() { engine.addEntityListener(new EntityListener() {
@Override @Override
public void entityAdded(Entity entity) { public void entityAdded(Entity entity) {
PhysicsSystem ps = engine.getSystem(PhysicsSystem.class); PhysicsSystem ps = engine.getSystem(PhysicsSystem.class);
ps.updateEntities(engine); ps.updateEntities(engine);
}
@Override
public void entityRemoved(Entity entity) {
PhysicsSystem ps = engine.getSystem(PhysicsSystem.class);
ps.updateEntities(engine);
}
});
engine.addSystem(new RenderingSystem());
engine.addEntityListener(new EntityListener() {
@Override
public void entityRemoved(Entity entity) {
RenderingSystem rs = engine.getSystem(RenderingSystem.class); RenderingSystem rs = engine.getSystem(RenderingSystem.class);
rs.updateEntities(engine); rs.updateEntities(engine);
} }
@Override @Override
public void entityAdded(Entity entity) { public void entityRemoved(Entity entity) {
PhysicsSystem ps = engine.getSystem(PhysicsSystem.class);
ps.updateEntities(engine);
RenderingSystem rs = engine.getSystem(RenderingSystem.class); RenderingSystem rs = engine.getSystem(RenderingSystem.class);
rs.updateEntities(engine); rs.updateEntities(engine);
} }
@ -94,7 +84,7 @@ public class GladiatorBrawler extends ApplicationAdapter {
public void initializeLevel() { public void initializeLevel() {
Entity ground = new Entity(); Entity ground = new Entity();
Sprite groundSprite = SpriteLoader.loadSprite(Name.GROUNDIMG, 0, 0, 256, 64); Sprite groundSprite = SpriteLoader.loadSprite(Name.GROUNDIMG);
CRenderedObject renderedObject = new CRenderedObject(groundSprite); CRenderedObject renderedObject = new CRenderedObject(groundSprite);
ground.add(renderedObject); ground.add(renderedObject);
CPhysics physics = new CPhysics().setMovable(false).setGravityApplied(false).setDynamic(false) CPhysics physics = new CPhysics().setMovable(false).setGravityApplied(false).setDynamic(false)
@ -103,7 +93,7 @@ public class GladiatorBrawler extends ApplicationAdapter {
physics.position.set(new Vector2(0, -4)); physics.position.set(new Vector2(0, -4));
ground.add(physics); ground.add(physics);
Sprite wallSprite = SpriteLoader.loadSprite(Name.WALLIMG, 0, 0, 64, 64); Sprite wallSprite = SpriteLoader.loadSprite(Name.WALLIMG);
Entity wall0 = new Entity(); Entity wall0 = new Entity();
CRenderedObject wall0RenderedObject = new CRenderedObject(wallSprite); CRenderedObject wall0RenderedObject = new CRenderedObject(wallSprite);