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