Question
please create these programs for me. Breakout Part I Setting up your classes This lab was designed to provide a good example of how to
please create these programs for me.
Breakout
Part I Setting up your classes
This lab was designed to provide a good example of how to use an abstract class and implement interfaces. This lab was also designed to help with understanding how inheritance works and how it supports code reuse.
Please create a new project and package for breakout. In that project, create the classes listed below based on the descriptions included. Create constructors and all the methods and instance variables listed below. All instance variables need to be doubles.
GameElement
Abstract Class that represents an object/element in the game and does collision checking. Contains instance variables width, height, x, and y.
Contains get and set methods for all instance variables. Contains an abstract method onCollision that takes a GameElement parameter and returns nothing. Contains a method checkCollision that takes a GameElement parameter and returns either true or false.
Renderable
Interface that indicates that an object is renderable (can be drawn/rendered on the screen). It contains a draw method that accepts a Canvas object and returns nothing. It draws this object on the Canvas.
Updateable
Interface that indicates that an object should be updated regularly on a given timescale. Contains an update method that takes no parameters and returns nothing.
Block
Class that extends GameElement and implements Renderable. It does not need to implement Updateable because the blocks do not move and therefore do not need to be updated. Contains a destroy method that has no parameters and returns nothing. onCollision with ball will call the destroy method. destroy will remove the Block from the game
draw will redraw the block on the screen
Ball
Class that extends GameElement and implements Renderable and Updateable. Contains instance variables for the velocity in the X direction, velocity in the Y direction.
Contains get and set methods for all instance variables
onCollision will bounce off of other objects. update will move the ball.
draw will redraw the ball on the screen
Paddle
Class that extends GameElement and implements Renderable and Updateable
Contains instance variables for velocity and direction (you can use a String like in Pong) onCollision does nothing. update will move paddle.
draw will redraw the paddle on the screen
Wall
Class that extends GameElement onCollision does nothing.
GameState
Instance variables of a list of Renderables, a list of Updateables, and a list of GameElements that can collide.
Include an add method that will add the object to any/all of the lists Include an updateAll method that updates all the game elements. Include a drawAll method that draws all the game elements Include a collideAll method that invokes the collision detection.
Breakout
This is the runner that is composed of the JavaFX graphics elements and the GameState object that contains lists of all of the gameElements. Starter code will be given to you.
Extra credit options:
AnimatedBlock
Class that extends Block Smoothly changes color over time.
StrongBlock
Class that extends Block hit will count to three hits then call destroy.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started