예제 #1
0
  private void loadCollisionBoxes() {
    MapLayer collisionLayer = map.getLayers().get("collisions");

    Game.debug("Inflating Collision Rectangles / Tile Data");

    for (RectangleMapObject object :
        collisionLayer.getObjects().getByType(RectangleMapObject.class)) {
      if (object.getProperties().containsKey("spawnpoint")) {
        spawnpoint = new Vector2(object.getRectangle().x, object.getRectangle().y);
        Game.debug("Set Spawn Point to: " + spawnpoint.toString());
      }
      if (!object.getProperties().containsKey("collision")) continue;
      Game.debug("Added Collision Rectangle at: " + object.getRectangle().toString());
      collisions.add(object.getRectangle());
    }
    Game.debug("Added " + collisions.size() + " Collision Rectangles");
  }
예제 #2
0
 public void drawDebugInformation(SpriteBatch batch) {
   Game.drawString("Collisions: " + collisions.size(), batch, 0, Gdx.graphics.getHeight() - 15);
   Game.drawString(
       "Player Pos: " + entities.get(0).getPos(), batch, 0, Gdx.graphics.getHeight() - 30);
 }