StrategyRed
+ think(ball Ball, model BallPit)
StrategyFactory
+ createStrategy(ball : Ball) : Strategy
BallPit
height: double width: double
balls: List
+ getCollissionBalls(): List
+ BallPit(width: double, height: double)
+ getHeight(): double
+ getWidth(): double
+ tick()
+ getBalls(): List
– checkCollision(ballA:Ball, ballB:Ball): boolean – handleCollision(ballA:Ball, ballB:Ball)
App
+ main(args: String[])
+ start(primaryStage: Stage)
StrategyBlack
– VEL : double = 0.017
<
+ think(ball Ball, model BallPit)
StrategyBlue
– VEL : double = 0.01
+ think(ball Ball, model BallPit)
StrategyContext
– strategy: Strategy
+ StrategyContext(strategy: Strategy) + think(ball Ball, model BallPit)
getCollissionBalls
GameWindow
– gc: GraphicsContext – scene: Scene
– model: BallPit
+ GameWindow(model: BallPit) + getScene(): Scene
+ run()
– draw()
Ball
– xPos: double
– yPos: double
– radius: double
– xVel:double
– yVel:double
– colour:Paint
– isCollisionHappened :Boolean = false;
+ getCollisionHappened(): boolean
+ Ball( startX: double, startY: double, startRadius: double, colour: Paint) + tick()
+ setxVel( xVel: double)
+ setyVel( yVel: double)
+ getRadius(): double
+ getxPos(): double
+ getyPos(): double
+ getColour(): Paint
+ getxVel(): double
+ getyVel(): double
+ setxPos(xPos: double)
+ setyPos(yPos: double)
+ think(model: BallPit)
+ think(ball Ball, model BallPit)