2014-08-10 17:19:40 +02:00
|
|
|
package de.samdev.colorrunner.game.world;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import de.samdev.colorrunner.game.world.entities.CRGameEntity;
|
2014-08-10 20:59:50 +02:00
|
|
|
import de.samdev.colorrunner.game.world.entities.gameentities.PlayerEntity;
|
2014-08-11 00:24:55 +02:00
|
|
|
import de.samdev.colorrunner.game.world.entities.gameentities.floor.DownStateFloorTileEntity;
|
|
|
|
import de.samdev.colorrunner.game.world.entities.gameentities.floor.LeftStateFloorTileEntity;
|
|
|
|
import de.samdev.colorrunner.game.world.entities.gameentities.floor.RightStateFloorTileEntity;
|
|
|
|
import de.samdev.colorrunner.game.world.entities.gameentities.floor.UpStateFloorTileEntity;
|
2014-08-10 19:41:06 +02:00
|
|
|
import de.samdev.colorrunner.input.GameInputListener;
|
2014-08-10 17:19:40 +02:00
|
|
|
|
2014-08-10 19:41:06 +02:00
|
|
|
public class CRGameWorld implements GameInputListener {
|
2014-08-11 00:24:55 +02:00
|
|
|
|
2014-08-10 19:41:06 +02:00
|
|
|
public PlayerEntity player;
|
2014-08-11 00:24:55 +02:00
|
|
|
|
2014-08-10 17:19:40 +02:00
|
|
|
public List<CRGameEntity> entities = new ArrayList<CRGameEntity>();
|
2014-08-11 00:24:55 +02:00
|
|
|
|
2014-08-10 17:19:40 +02:00
|
|
|
public FPSCounter fps = new FPSCounter();
|
2014-08-11 00:24:55 +02:00
|
|
|
|
2014-08-10 17:19:40 +02:00
|
|
|
public CRGameWorld() {
|
|
|
|
|
2014-08-10 19:41:06 +02:00
|
|
|
addEntity(player = new PlayerEntity(this, 40, 290));
|
2014-08-11 00:24:55 +02:00
|
|
|
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 1 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 2 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 3 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 4 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 5 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 6 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 7 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 8 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 9 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 10 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 11 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 12 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 13 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 14 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 15 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 16 * 32, 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 17 * 32, 32));
|
|
|
|
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 18 * 32, 1 * 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 19 * 32, 2 * 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 19 * 32, 3 * 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 18 * 32, 4 * 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 18 * 32, 5 * 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 19 * 32, 6 * 32));
|
|
|
|
addEntity(new UpStateFloorTileEntity(this, 20 * 32, 7 * 32));
|
|
|
|
|
|
|
|
addEntity(new RightStateFloorTileEntity(this, 21 * 32, 32));
|
|
|
|
addEntity(new RightStateFloorTileEntity(this, 22 * 32, 32));
|
|
|
|
addEntity(new RightStateFloorTileEntity(this, 26 * 32, 32));
|
|
|
|
addEntity(new RightStateFloorTileEntity(this, 27 * 32, 32));
|
|
|
|
addEntity(new RightStateFloorTileEntity(this, 28 * 32, 32));
|
|
|
|
addEntity(new RightStateFloorTileEntity(this, 29 * 32, 32));
|
|
|
|
addEntity(new RightStateFloorTileEntity(this, 29 * 32, 64));
|
|
|
|
|
|
|
|
addEntity(new LeftStateFloorTileEntity(this, 32 * 32, 32));
|
|
|
|
addEntity(new LeftStateFloorTileEntity(this, 33 * 32, 32));
|
|
|
|
addEntity(new LeftStateFloorTileEntity(this, 34 * 32, 32));
|
|
|
|
addEntity(new LeftStateFloorTileEntity(this, 35 * 32, 32));
|
|
|
|
addEntity(new LeftStateFloorTileEntity(this, 36 * 32, 32));
|
|
|
|
addEntity(new LeftStateFloorTileEntity(this, 37 * 32, 32));
|
|
|
|
addEntity(new LeftStateFloorTileEntity(this, 38 * 32, 32));
|
|
|
|
addEntity(new LeftStateFloorTileEntity(this, 39 * 32, 32));
|
|
|
|
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 11 * 32, 456));
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 12 * 32, 456));
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 13 * 32, 456));
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 14 * 32, 456));
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 15 * 32, 456));
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 16 * 32, 456));
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 17 * 32, 456));
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 18 * 32, 456));
|
|
|
|
addEntity(new DownStateFloorTileEntity(this, 19 * 32, 456));
|
2014-08-10 17:19:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void update(float delta) {
|
|
|
|
fps.Inc();
|
2014-08-11 00:24:55 +02:00
|
|
|
|
2014-08-10 17:19:40 +02:00
|
|
|
for (CRGameEntity ent : entities) {
|
|
|
|
ent.update(delta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-10 19:41:06 +02:00
|
|
|
public CRGameEntity addEntity(CRGameEntity ent) {
|
2014-08-10 17:19:40 +02:00
|
|
|
entities.add(ent);
|
2014-08-11 00:24:55 +02:00
|
|
|
|
2014-08-10 19:41:06 +02:00
|
|
|
return ent;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void doJump() {
|
|
|
|
player.jump();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void switchColor(SwipeDirection sd) {
|
|
|
|
player.switchPhase(sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void doFly() {
|
|
|
|
player.fly();
|
2014-08-10 17:19:40 +02:00
|
|
|
}
|
|
|
|
}
|