示例#1
0
  public HubState(GameStateManager gsm) {

    super(gsm);

    fire = new Rectangle(1 * TileMap.tileSize, 13 * TileMap.tileSize, 16, 16);

    earth = new Rectangle(5 * TileMap.tileSize, 13 * TileMap.tileSize, 16, 16);

    water = new Rectangle(14 * TileMap.tileSize, 13 * TileMap.tileSize, 16, 16);

    air = new Rectangle(5 * TileMap.tileSize, 9 * TileMap.tileSize, 16, 16);

    try {
      // tileMap = new TileMap("hub");
      bg = ImageIO.read(this.getClass().getResourceAsStream("/Resources/Backgrounds/hub.png"));

      lvmk = LevelMakerData.parse("hub");
      tileMap = new TileMap(lvmk.getTileMap(), lvmk.getTileTypes(), lvmk.getEnemyData());
      player = new Player(tileMap, gsm.getDifficulty());
      textEventListener = new TextEventListener();

    } catch (IOException e) {
      System.out.println("Couldn't find something");
    } catch (Exception e) {
      System.out.println("Some other error");
      e.printStackTrace();
    }
  }
示例#2
0
  @Override
  public void init() {
    player.spawn();
    tileMap.init();
    ArrayList<String> textEvents = lvmk.getEvents();
    for (String s : textEvents) {
      textEventListener.add(s);
    }
    paused = false;

    if (!isPlaying()) playSound("theme");
  }