Example #1
0
 private void paintMenu(Graphics2D g2d) {
   if (showMenu == true) {
     if (c.getPoints() > c.getHighscore().getLowestPointsInTable() && c.getLifes() == 0) {
       menu.setState(4);
     }
     menu.draw(g2d);
   }
 }
Example #2
0
 private void paintLifes(Graphics2D g2d) {
   int lifes = c.getLifes();
   for (int i = 0; i < lifes; i++) {
     ImageIcon imageIcon =
         new ImageIcon(
             ItemFactory.class.getResource(Config.getImagePath() + Level.getLevel().getLife()));
     Life life =
         ItemFactory.createLife(
             Config.getBoardDimension().getLength() - (2 + i) * imageIcon.getIconWidth(),
             0,
             imageIcon);
     g2d.drawImage(life.getImage(), life.getPosition().getX(), life.getPosition().getY(), this);
   }
 }
Example #3
0
  @Override
  public void paint(Graphics g) {
    super.paint(g);

    // menu on game over
    if (c.getLifes() < 1) {
      showMenu = true;
    }

    this.paintBackground((Graphics2D) g);
    this.paintItems((Graphics2D) g);
    this.paintLifes((Graphics2D) g);
    this.paintScore((Graphics2D) g);
    this.paintMenu((Graphics2D) g);

    Toolkit.getDefaultToolkit().sync();
    g.dispose();
  }
Example #4
0
 /** Toggle the menu */
 public void toggleMenu() {
   if (c.getLifes() > 0) {
     c.setPause(!c.isPaused());
     showMenu = !showMenu;
   }
 }