Ejemplo n.º 1
0
 /**
  * Resets the player to a checkpoint with the given CheckPointInfo
  *
  * @param info
  */
 public void resetCheckpoint(CheckPointInfo info) {
   state = info.getState();
   velocity = Vector2.Zero;
   health = info.getHealth();
   mana = info.getMana();
   heading = info.getHeading();
   stats = info.getStats();
   screenPosition = info.getPosition();
   collisionRect = info.getRectangle();
   statusbar.setHealth(health);
   statusbar.setMana(mana);
 }
Ejemplo n.º 2
0
  @SuppressWarnings("incomplete-switch")
  @Override
  public void draw(Graphics2D graphics) {
    ElementalShield cs = spellManager.getCurrentShield();
    if (cs != null) {
      Color[] c = new Color[3];
      c[0] = new Color(0, 0, 0, 0);
      c[1] = new Color(0, 0, 0, 0);
      ElementType type = cs.getElementType();

      switch (type) {
        case Earth:
          c[2] = new Color(0.45f, 0.4f, 0.15f, 0.85f);
          break;
        case Fire:
          c[2] = new Color(1.0f, 0.0f, 0.0f, 0.7f);
          break;
        case Water:
          c[2] = new Color(0.3f, 0.3f, 0.8f, 0.7f);
          break;
      }

      float[] dist = {0.0f, 0.25f, 1f};
      RadialGradientPaint rgp =
          new RadialGradientPaint(
              new Point2D.Float((int) screenPosition.x + 16, (int) screenPosition.y + 16),
              20,
              dist,
              c);
      graphics.setPaint(rgp);
      graphics.fillOval((int) screenPosition.x - 4, (int) screenPosition.y - 4, 40, 40);
    }

    graphics.drawImage(getTexture(), (int) screenPosition.x, (int) screenPosition.y, null);
    if (controlled) {
      spellManager.draw(graphics);
      statusbar.draw(graphics);
    }

    if (isInNetwork && controllerActive) {
      if (controller.isPressed(KeyEvent.VK_T)) DeathMatchStatistics.getInstance().draw(graphics);
    }
  }