Answered step by step
Verified Expert Solution
Link Copied!

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){
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

Define job pricing. What is the purpose of job pricing?

Answered: 1 week ago

Question

What are some companywide pay plans? Briefly discuss each.

Answered: 1 week ago