Exemplo n.º 1
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();
  }
Exemplo n.º 2
0
 /** Associates specified background with this sprite. */
 public void setBackground(Background backgr) {
   this.background = backgr;
   if (this.background == null) {
     this.background = Background.getDefaultBackground();
   }
 }