/*
 * This code is protected under the Gnu General Public License (Copyleft), 2005 by
 * IBM and the Computer Science Teachers of America organization. It may be freely
 * modified and redistributed under educational fair use.
 */

/*
 * Ball Class
 * By Philip Peng
 * October 4th, 2007
 * For Mr. Benum
 * 
 */

import csta.ibm.pong.GameObject;
import java.awt.Color;
import java.awt.Graphics;

public class Paddle extends GameObject {

// State variables
	int dX; // Movement speed - note that dY isn't used... for now...
	int score; // Paddle's score/number of points 
	boolean moveL, moveR; // Move checks
	
// Parent variables
	Color c = Color.WHITE; // Make accessible to Ball class

// Over-riding paint() method;
	public void paint(Graphics g) {
		g.setColor(c);
		
		// Draw round rectangle with same dimensions, aka a circle
		// Note that using .fillRoundRect instead of .fillOval makes rounder,
		// less pixelated circles at small radii ; )
		g.fillRoundRect( 
				0,
				0,
				getWidth(),
				getHeight(),
				getHeight(),
				getHeight()
				);
		
	} // paint(Graphics g) method

// Over-riding setColor(Color c) method; make accessible to Ball class
	public void setColor(Color c) {
		this.c = c;
	} // setColor(Color c) method
	
// Act method; auto-loops every few milliseconds
	public void act() {
		
		// Update location
			if (moveL) {
				this.setX(this.getX() - dX);
			}
			if (moveR) {
				this.setX(this.getX() + dX);
			}
				
	} // act() method
	
} // End of Paddle class
