Answered step by step
Verified Expert Solution
Question
1 Approved Answer
package gamefinal; import java.awt.Color; import java.awt.Graphics; import java.awt.Color; import java.util.Random; public abstract class Circle extends Shape { private int radius; private int width; private int
package gamefinal;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Color;
import java.util.Random;
public abstract class Circle extends Shape
private int radius;
private int width;
private int height;
public Circle int x int y int radius
superxy radius, x;
this.radius radius;
public void move
int x ;
int y ;
int radius ;
public void moveRandomlymovement method
Random random new Random;
int direction random.nextBoolean : ;
int distance random.nextInt;
x directiondistance;
if x x ;
public void paint Graphics brushpaint the circle
brush.setColorColorwhite;
brush.fillOvalxywidth,height;
public int get
return x;
public int getY
return y;
public int getRadius
return radius;
please take my java code and add the code that detects collisions between this circle class and my bullit class, as well as the seperate code that instantiates my circle class into my main asteroid class.
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