Question: 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){
super(x,y, radius, x);
this.radius= radius;
}
//public void move (){
int x =20;
int y =100;
// int radius =50;
//}
public void moveRandomly(){//movement method
Random random = new Random();
int direction = random.nextBoolean()?1 : -1;
int distance = random.nextInt(10);
x+= direction*distance;
if (x<0) x =0;
}
public void paint (Graphics brush){//paint the circle
brush.setColor(Color.white);
brush.fillOval(x,y,width,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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!