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 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 update() { player.update(); player.checkAttack(enemies); finish.update(); finish.checkGrab(player); System.out.println(player.getx()); System.out.println(player.gety()); bg.setPosition(tileMap.getx(), tileMap.gety()); tileMap.setPosition(GamePanel.WIDTH / 2 - player.getx(), GamePanel.HEIGHT / 2 - player.gety()); if (player.isDead()) { player.setPosition(130, 2375); player.revive(); player.reset(); restart(); } // for(int i = 0; i < drinks.size(); i++){ // Alcohol a = drinks.get(i); // a.update(); // if(a.shouldRemove()){ // drinks.remove(i); // i--; // } // } // for (int i = 0; i < enemies.size(); i++) { Enemy e = enemies.get(i); e.update(); if (player.isDrunk()) { e.kill(); } if (e.isDead()) { enemies.remove(i); e.addScore(Level2State.score); i--; } } bg.setPosition(tileMap.getx(), tileMap.gety()); }
public void draw(Graphics2D g) { bg.draw(g); tileMap.draw(g); finish.draw(g); player.draw(g); for (int i = 0; i < enemies.size(); i++) { enemies.get(i).draw(g); } hud.draw(g); }
MenuState(GameStateManager gsm) { super(gsm); try { bg = new Background("/Backgrounds/Menu.gif", 1); bg.setVector(-0.1, 0); titleColor = Color.WHITE; titleFont = new Font("Times New Roman", Font.PLAIN, 28); font = new Font("Times New Roman", Font.PLAIN, 12); music = new Audio("/Audio/mainTheme.wav"); music.play(); } catch (Exception e) { e.printStackTrace(); } }
public void draw(Graphics2D g) { bg.draw(g); // draw title g.setColor(titleColor); g.setFont(titleFont); g.drawString("Rollin'", 120, 100); g.setFont(font); for (int i = 0; i < options.length; i++) { if (i == currentOption) { g.setColor(Color.BLACK); } else { g.setColor(Color.WHITE); } g.drawString(options[i], 145, 140 + i * 15); } }
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); }
public void update() { bg.update(); handleInput(); gsm.score = 0; gsm.lives = 5; }