コード例 #1
0
ファイル: Level.java プロジェクト: russjr08/RunAway-Java
  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
ファイル: Level.java プロジェクト: russjr08/RunAway-Java
 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);
 }