Пример #1
10
  public void render() {
    Graphics g = screen.getGraphics();
    // Drawing Things!
    sky.render(g);
    level.render(
        g,
        (int) sX,
        (int) sY,
        (pixel.width / Tile.tileSize) + 2,
        (pixel.height / Tile.tileSize) + 2);
    character.render(g);
    inventory.render(g);
    health.render(g);

    for (int i = 0; i < mob.toArray().length; i++) {
      mob.get(i).render(g);
    }
    g = getGraphics();

    g.drawImage(screen, 0, 0, size.width, size.height, 0, 0, pixel.width, pixel.height, null);

    g.dispose();
  }
Пример #2
0
 private Color getColorFor(double health) {
   switch (Health.getHealthFor(health)) {
     case POOR:
       return Color.RED;
     case AVERAGE:
       return Color.YELLOW;
     default:
       return Color.GREEN;
   }
 }
Пример #3
0
 public void tick() {
   if (inGame) {
     level.tick(
         (int) sX,
         (int) sY,
         (pixel.width / Tile.tileSize) + 2,
         (pixel.height / Tile.tileSize) + 2);
     character.tick();
     sky.tick();
     health.tick();
     for (int i = 0; i < mob.toArray().length; i++) {
       mob.get(i).tick();
     }
   }
 }