Пример #1
0
  /** Sets specified image as this sprite image. */
  public void setImage(GameImage image) {
    this.image = image;

    this.width = this.height = 0;
    if (image != null) {
      this.width = image.getWidth();
      this.height = image.getHeight();
    }
  }
Пример #2
0
  /** Creates new <code>Sprite</code> with specified image and location. */
  public Sprite(GameImage blood, double x, double y) {
    // init variables
    this.x = this.oldX = x;
    this.y = this.oldY = y;

    // sprite image
    if (blood != null) {
      this.image = blood;
      this.width = blood.getWidth();
      this.height = blood.getHeight();
    }

    this.background = Background.getDefaultBackground();
  }