private synchronized void createLevel(String levelFile) { try { level = Level.fromFile(levelFile); } catch (Exception ex) { throw new RuntimeException("Unable to load level", ex); } level.init(); players[0] = new Player( synchedKeys[0], mouseButtons, level.width * Tile.WIDTH / 2 - 16, (level.height - 5 - 1) * Tile.HEIGHT - 16, Team.Team1); players[0].setFacing(4); level.addEntity(players[0]); level.addEntity(new Base(34 * Tile.WIDTH, 7 * Tile.WIDTH, Team.Team1)); if (isMultiplayer) { players[1] = new Player( synchedKeys[1], mouseButtons, level.width * Tile.WIDTH / 2 - 16, 7 * Tile.HEIGHT - 16, Team.Team2); // players[1] = new Player(synchedKeys[1], 10, 10); level.addEntity(players[1]); level.addEntity(new Base(32 * Tile.WIDTH - 20, 32 * Tile.WIDTH - 20, Team.Team2)); } player = players[localId]; player.setCanSee(true); }
private synchronized void createLevel(LevelInformation li) { try { level = Level.fromFile(li); } catch (Exception ex) { ex.printStackTrace(); showError("Unable to load map."); return; } initLevel(); paused = false; }