145 lines
2.4 KiB
Java
145 lines
2.4 KiB
Java
package break_out.model;
|
|
|
|
import break_out.Constants;
|
|
|
|
import java.awt.*;
|
|
|
|
/**
|
|
* This class contains the information about the paddles characteristics and behavior
|
|
*
|
|
* @author Gruppe 175: Moritz Henseleit, Ruben Meyer
|
|
*/
|
|
public class Paddle implements IPaddle {
|
|
|
|
/**
|
|
* The paddles position on the playground
|
|
*/
|
|
private Position position;
|
|
|
|
/**
|
|
* The paddles sizing
|
|
*/
|
|
private int width;
|
|
private int height;
|
|
|
|
/**
|
|
* The paddles color
|
|
*/
|
|
private Color color;
|
|
|
|
/**
|
|
* The constructor of a paddle
|
|
*
|
|
* @param position paddles initial position
|
|
*/
|
|
public Paddle(Position position) {
|
|
this.position = position;
|
|
|
|
// set sizing
|
|
width = Constants.PADDLE_WIDTH;
|
|
height = Constants.PADDLE_HEIGHT;
|
|
|
|
// set color
|
|
color = Color.CYAN;
|
|
}
|
|
|
|
/**
|
|
* The getter for the paddles position
|
|
*
|
|
* @return position The paddles current position
|
|
*/
|
|
public Position getPosition() {
|
|
return position;
|
|
}
|
|
|
|
/**
|
|
* The setter for the paddles position
|
|
*
|
|
* @param position The paddles new position
|
|
*/
|
|
public void setPosition(Position position) {
|
|
this.position = position;
|
|
}
|
|
|
|
/**
|
|
* The getter for the paddles color
|
|
*
|
|
* @return color The paddles current color
|
|
*/
|
|
public Color getColor() {
|
|
return color;
|
|
}
|
|
|
|
/**
|
|
* The setter for the paddles color
|
|
*
|
|
* @param color The paddles new color
|
|
*/
|
|
public void setColor(Color color) {
|
|
this.color = color;
|
|
}
|
|
|
|
/**
|
|
* The getter for the paddles width
|
|
*
|
|
* @return width The paddles current width
|
|
*/
|
|
public int getWidth() {
|
|
return width;
|
|
}
|
|
|
|
/**
|
|
* The setter for the paddles width
|
|
*
|
|
* @param width The paddles new width
|
|
*/
|
|
public void setWidth(int width) {
|
|
this.width = width;
|
|
}
|
|
|
|
/**
|
|
* The getter for the paddles height
|
|
*
|
|
* @return height The paddles current height
|
|
*/
|
|
public int getHeight() {
|
|
return height;
|
|
}
|
|
|
|
/**
|
|
* The setter for the paddles height
|
|
*
|
|
* @param height The paddles new height
|
|
*/
|
|
public void setHeight(int height) {
|
|
this.height = height;
|
|
}
|
|
|
|
/**
|
|
* The getter for the paddles direction
|
|
*
|
|
* @return direction The paddles current direction
|
|
*/
|
|
public int getDirection() {
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* The setter for the paddles direction
|
|
*
|
|
* @param direction The paddles new direction
|
|
*/
|
|
public void setDirection(int direction) {
|
|
|
|
}
|
|
|
|
/**
|
|
* Updates paddles position based on balls position
|
|
*
|
|
* @param ball The ball
|
|
*/
|
|
public void updatePosition(Ball ball) {
|
|
|
|
}
|
|
}
|