Package break_out.model
Class Paddle
- java.lang.Object
-
- break_out.model.Paddle
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Color
color
The paddles colorprivate int
direction
The paddles direction on the playground only -1,0,+1 are valid valuesprivate int
height
private Position
position
The paddles position on the playgroundprivate int
width
The paddles sizing
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Color
getColor()
The getter for the paddles colorint
getDirection()
The getter for the paddles directionint
getHeight()
The getter for the paddles heightPosition
getPosition()
The getter for the paddles positionint
getWidth()
The getter for the paddles widthvoid
setColor(java.awt.Color color)
The setter for the paddles colorvoid
setDirection(int direction)
The setter for the paddles directionvoid
setHeight(int height)
The setter for the paddles heightvoid
setPosition(Position position)
The setter for the paddles positionvoid
setWidth(int width)
The setter for the paddles widthvoid
updatePosition(Ball ball)
Updates paddles position based on balls position
-
-
-
Field Detail
-
position
private Position position
The paddles position on the playground
-
direction
private int direction
The paddles direction on the playground only -1,0,+1 are valid values
-
width
private int width
The paddles sizing
-
height
private int height
-
color
private java.awt.Color color
The paddles color
-
-
Constructor Detail
-
Paddle
public Paddle(Position position)
The constructor of a paddle- Parameters:
position
- paddles initial position
-
-
Method Detail
-
getPosition
public Position getPosition()
The getter for the paddles position- Specified by:
getPosition
in interfaceIPaddle
- Returns:
- position The paddles current position
-
setPosition
public void setPosition(Position position)
The setter for the paddles position- Specified by:
setPosition
in interfaceIPaddle
- Parameters:
position
- The paddles new position
-
getColor
public java.awt.Color getColor()
The getter for the paddles color
-
setColor
public void setColor(java.awt.Color color)
The setter for the paddles color
-
getWidth
public int getWidth()
The getter for the paddles width
-
setWidth
public void setWidth(int width)
The setter for the paddles width
-
getHeight
public int getHeight()
The getter for the paddles height
-
setHeight
public void setHeight(int height)
The setter for the paddles height
-
getDirection
public int getDirection()
The getter for the paddles direction- Specified by:
getDirection
in interfaceIPaddle
- Returns:
- direction The paddles current direction
-
setDirection
public void setDirection(int direction)
The setter for the paddles direction- Specified by:
setDirection
in interfaceIPaddle
- Parameters:
direction
- The paddles new direction
-
updatePosition
public void updatePosition(Ball ball)
Updates paddles position based on balls position- Specified by:
updatePosition
in interfaceIPaddle
- Parameters:
ball
- The ball
-
-