public static Level get(int layer, Player player) { Level level = loadedMaps.get(layer); if (level == null) { level = new Level( Art.load("/res/map/layer_" + layer + ".png"), Art.load("/res/map/items_" + layer + ".png"), player, layer); loadedMaps.put(layer, level); } return level; }
public void create() { Art.load(); Sound.load(); Gdx.input.setInputProcessor(input); running = true; setScreen(new TitleScreen()); // setScreen(new GameScreen()); }
public static void loadMap(int layer, Player player, RandomAccessFile loadfile) throws IOException { Level level = new Level(Art.load("/res/map/layer_" + layer + ".png"), null, player, layer, true); for (int x = 0; x < level.w; x++) { for (int y = 0; y < level.h; y++) { if (x == 0 && y == 0) { System.out.printf("Entering first tile at %d!\n", loadfile.getFilePointer()); } Tile tileToSave = level.getTile(x, y); tileToSave.loadTile(loadfile); } } level.init(); loadedMaps.put(layer, level); }
protected void hurt(double xd, double zd) { sprite.col = Art.getCol(0xff0000); hurtTime = 15; double dd = Math.sqrt(xd * xd + zd * zd); xa += xd / dd * 0.2; za += zd / dd * 0.2; Sound.hurt2.play(); health--; if (health <= 0) { int xt = (int) (x + 0.5); int zt = (int) (z + 0.5); level.getBlock(xt, zt).addSprite(new PoofSprite(x - xt, 0, z - zt)); die(); remove(); Sound.kill.play(); } }
public void startMusic() { Art.startMusic(0); }
public void tick() { xMario += xMarioA; yMario += yMarioA; tick++; int x = xMario / 16; int y = yMario / 16; if (level[x][y] == TILE_ROAD) { data[x][y] = 0; } if (moveTime > 0) { moveTime--; } else { xMarioA = 0; yMarioA = 0; if (canEnterLevel && keys[Mario.KEY_JUMP]) { if (level[x][y] == TILE_LEVEL && data[x][y] == -11) { } else { if (level[x][y] == TILE_LEVEL && data[x][y] != 0 && data[x][y] > -10) { Mario.levelString = (worldNumber + 1) + "-"; int difficulty = worldNumber + 1; int type = LevelGenerator.TYPE_OVERGROUND; if (data[x][y] > 1 && new Random(seed + x * 313211 + y * 534321).nextInt(3) == 0) { type = LevelGenerator.TYPE_UNDERGROUND; } if (data[x][y] < 0) { if (data[x][y] == -2) { Mario.levelString += "X"; difficulty += 2; } else if (data[x][y] == -1) { Mario.levelString += "?"; } else { Mario.levelString += "#"; difficulty += 1; } type = LevelGenerator.TYPE_CASTLE; } else { Mario.levelString += data[x][y]; } Art.stopMusic(); marioComponent.startLevel(seed * x * y + x * 31871 + y * 21871, difficulty, type); } } } canEnterLevel = !keys[Mario.KEY_JUMP]; if (keys[Mario.KEY_LEFT]) { keys[Mario.KEY_LEFT] = false; tryWalking(-1, 0); } if (keys[Mario.KEY_RIGHT]) { keys[Mario.KEY_RIGHT] = false; tryWalking(1, 0); } if (keys[Mario.KEY_UP]) { keys[Mario.KEY_UP] = false; tryWalking(0, -1); } if (keys[Mario.KEY_DOWN]) { keys[Mario.KEY_DOWN] = false; tryWalking(0, 1); } } }
public void init() { graphicsConfiguration = getGraphicsConfiguration(); // if (graphicsConfiguration != null) { Art.init(graphicsConfiguration); // } }