 = height;
    x = x + dx;
    y = y + dy;
    int newx = x;
    int newy = y;
    int offset = curFrame * frameWidth;

    // check if sprite is in the Playfield
    if (newx < 0) {
      w += newx;
      newx = 0;
    }
    if (newy < 0) {
      h += newy;
      newy = 0;
    }
    if (newx + w > bgnd.getWidth())
      w = bgnd.getWidth() - newx;
    if (newy + h > bgnd.getHeight())
      h = bgnd.getHeight() - newy;
    // set the pixels of the playfield to the correct values
    System.out.println("new: " + newx + " w: " + w + " newy: " + newy + " h: " + h);
    for (int i = newx; i < newx + w; i++) {
      for (int j = newy; j < newy + h; j++) {
	//System.out.println("Checking for transparency.");
	int pixel = this.getPixel(i-newx+offset, j-newy);
	if ((pixel >> 24) != 0) {
	  //System.out.println("Calling setPixel with i:  " + i + " j: " + j);
	  bgnd.setPixel(pixel, i, j);
	}
      }
    } 
  } // end Draw

  public void nextState() {
    // Sets animated sprite to next frame, position
    if (frame < (((Track) tracks.elementAt(curTrack)).getSize()) - 1)
      frame++;
    curFrame = ((Track) tracks.elementAt(curTrack)).getFrame(frame);
    time++;
    x += dx;
    y += dy;
  } // end nextState

  public void setTrack(int track) {
    // Sets the current track
    curTrack = track;
  } // end setTrack

  public void addTrack(int numFrames, int[] series) {
    tracks.addElement(new Track(numFrames, series));
  }

/* A track is a series of frames. The frame is displayed for ticks periods.
   The sprite's position is then moved (dx, dy) pixels.
   */

} // end class AnimatedSprite
