//PS1.JAVA

		/*
		Frame application = new Frame("6.837 Problem Set 1");
		application.addWindowListener(new WindowAdapter () {
			public void windowClosing (WindowEvent e) {
				//dispose();
				System.exit(0);
			}
		});
		*/
		/*
		ps1Applet ps1 = new ps1Applet();
		application.setSize(400, 400);
		application.show();
		application.add(ps1);
		ps1.init();
		ps1.start();
		ps1.show();
		*/
		
			//sprite3 = new AnimatedSprite();
			//sprite3.setTransparentColor(Color.lightGray.getRGB());
			
			//sprite3.addFrame(new Sprite(image2));
			//sprite3.addFrame(new Sprite(image5));
			//sprite3.addFrame(new Sprite(image6));
			//sprite3.addFrame(new Sprite(image2));
			//sprite3.addFrame(new Sprite(image5));

			//background.addSprite(sprite3);

			//sprite3.setLocation(new Point(200, 50));			
			//background.draw();


				/*
				int x = e.getX();
				int y = e.getY();

				int offsetX = e.getX() - offset.x;
				int offsetY = e.getY() - offset.y;
				//handles dragging sprite out of playfield
				if (currentSelectedSprite != null) {
					if (offsetX < 0)
						x = (int)(currentSelectedSprite.getWidth() / 2);
					if(offsetX > getSize().width)
						x = getSize().width - (int)(currentSelectedSprite.getWidth() / 2);
					if (offsetY < 0)
						y = (int)(currentSelectedSprite.getHeight() / 2);
					if (offsetY > getSize().height)
						x = getSize().height - (int)(currentSelectedSprite.getHeight() / 2);

					moveSprite(new Point(x, y));

				}
				*/

			
				/*
				try {
					selectSprite(e);
				} catch (NoSpriteLocatableException ee) {
					moveSprite(new Point(e.getX(), e.getY()));
				}
				*/

				/*
				try {
					currentSelectedSprite = background.getSpriteAtLocation(
						new Point(e.getX() - offset.x, e.getY() - offset.y));
					renderSpritesOnBG();
					//for debugging				
					outputToStatus("Selected sprite of dimension (" + 
						currentSelectedSprite.getWidth() + ", " + 
						currentSelectedSprite.getHeight() + ").");
					outputToLocationBar("(" + e.getX() + ", " + e.getY() + ").");
					outputSavedBG();
				} catch (NoSpriteLocatableException ee) {
					if (currentSelectedSprite != null) {	//making a sprite go somewhere
						currentSelectedSprite.setLocation(
							new Point(e.getX() - offset.x - (int)(currentSelectedSprite.getWidth() / 2),
							e.getY() - offset.y - (int)(currentSelectedSprite.getHeight() / 2)));
						renderSpritesOnBG();
						//for debugging				
						outputToStatus("Moved sprite of dimension (" + 
							currentSelectedSprite.getWidth() + ", " + 
							currentSelectedSprite.getHeight() + ").");
						outputToLocationBar("(" + e.getX() + ", " + e.getY() + ").");
						
						return;
					}
					//for debugging				
					outputToStatus("Did not select a sprite.");
				}
				*/


//SPRITE.JAVA

		//if ((toLocationOnRaster.x > toRaster.getWidth()) || 
		//	(toLocationOnRaster.y > toRaster.getHeight()) ||
		//	((toLocationOnRaster.y + fromRaster.getHeight()) < 0) || 
		//	((toLocationOnRaster.x + fromRaster.getWidth()) < 0))
		//	return;	//this is an error and should never happen!


		/*
		left = (left < 0) ? -left : left;
		top = (top < 0) ? -top : top;
		right = (right > rasPlayField.getWidth()) ? getWidth() - (right - rasPlayField.getWidth()) : getWidth();
		bottom = (bottom > rasPlayField.height) ? getHeight() - (bottom - rasPlayField.getHeight()) : getHeight();
		*/

		/*
		int x, y;
		Rectangle clippedRegion = clip(rasPlayField);
		int clippedWidth = clippedRegion.getWidth();
		int clippedHeight = clippedRegion.getHeight();
		int clippedX = clippedRegion.x;
		int clippedY = clippedRegion.y;		
		int rasPlayFieldClipped = rasPlayField.getWidth() - width;
		theSavedBackground = new Raster(clippedWidth, clippedHeight);
		int currentPixelOnPlayField = theLocation.x + theLocation.y * rasPlayField.getWidth();
		int currentPixelOnSprite = 0;
		
		//int spriteY = clippedY;
		int clippedRight = clippedX + clippedWidth;
		int clippedBottom = clippedY + clippedHeight;
		int clippedYLimit = clippedBottom * width;

		for (y = clippedY; y < clippedYLimit; y += width) {
			for (x = clippedX; x < clippedRight; x++) {
				if ((pixel[currentPixelOnSprite] & RGBMask) != (theTransparentColor & RGBMask)) {
					theSavedBackground.pixel[currentPixelOnSprite] = rasPlayField.pixel[currentPixelOnPlayField];
					rasPlayField.pixel[currentPixelOnPlayField] = pixel[currentPixelOnSprite];	// & RGBMask
				}						
				currentPixelOnPlayField++;
				currentPixelOnSprite++;
			}
			//spriteY++;
			
			currentPixelOnPlayField += rasPlayFieldClipped;
		}
		
		
		/*
		//this is a logical, but less efficient method to draw the sprite
		int x, y;

		Rectangle clippedRegion = clip(rasPlayField);
		theSavedBackground = new Raster(clippedRegion.getWidth(), clippedRegion.getHeight());
		
		for (x = 0; x < width; x++) {
			for (y = 0; y < height; y++) {
				if (getPixel(x, y) == theTransparentColor) {
					if (clippedRegion.contains(x, y)) {
						theSavedBackground.setPixel(getPixel(x, y), x - clippedRegion.x, y - clippedRegion.y);
						rasPlayField.setPixel(getPixel(x, y) ,theLocation.x, theLocation.y);
					}
				}
			}
		}
		*/

