public void update() { handleInput(); if (!fadein.isDone()) { fadein.update(); } if (!fadeout.isDone()) { fadeout.update(); } if (gsm.getCurrentLevel() == 4) { ji.checkCatch(rae); } for (int i = 0; i < pictures.size(); i++) { Images j = pictures.get(i); j.update(); } whatUpdate(); bg.update(); for (int i = 0; i < walls.size(); i++) { Wall w = walls.get(i); if (!w.removed()) { w.checkCollision(ji); w.checkCollision(rae); } if (w.shouldRemove()) { walls.remove(wall); i--; } } // wall.checkCollision(ji); }
public void draw(Graphics2D g) { bg.draw(g); tileMap.draw(g); for (int i = 0; i < pictures.size(); i++) { Images j = pictures.get(i); j.draw(g); } // pinkDoor.Draw(g); // greenDoor.Draw(g); for (int i = 0; i < buttons.size(); i++) { Button b = buttons.get(i); b.draw(g); } for (int i = 0; i < doors.size(); i++) { Door d = doors.get(i); d.Draw(g); } for (int i = 0; i < players.size(); i++) { MapObject m = players.get(i); m.draw(g); } for (int i = 0; i < walls.size(); i++) { walls.get(i).draw(g); } if (!fadein.isDone()) { fadein.draw(g); } fadeout.draw(g); }
public void init() { walls = new ArrayList<Wall>(); buttons = new ArrayList<Button>(); tileMap = new TileMap(32); tileMap.loadMap("/Maps/Level" + gsm.getCurrentLevel() + ".map"); System.out.println("/Maps/Level" + gsm.getCurrentLevel() + ".map"); tileMap.loadTiles("/Tilesets/grasstileset.png"); tileMap.setPosition(-0, 0); fadein = new FadeIn(tileMap, 20); fadein.setPosition(320, 240); fadeout = new FadeOut(tileMap, 20); fadeout.setPosition(320, 240); players = new ArrayList<MapObject>(); if (gsm.getCurrentLevel() >= 3) { ji = new Ji(tileMap, true); players.add(ji); rae = new Rae(tileMap, true); players.add(rae); } populateDoors(); setItUp(); bg = new Background("/Backgrounds/cloudbg.png", 0.1); bg.setVector(-0.1, 0); tileMap.setPosition(0, 0); tileMap.setTween(1); startMusic(); // JukeBox.load("Audio/CuriousCritters2.mp3", "level1"); // JukeBox.loop("level1", 600, JukeBox.getFrames("level1") - 2200); }