-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExplosion.java
More file actions
34 lines (28 loc) · 837 Bytes
/
Copy pathExplosion.java
File metadata and controls
34 lines (28 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.awt.*;
public class Explosion {
// Fields
private double x;
private double y ;
private int r;
private int maxRadius;
// Constructor '
public Explosion (double x , double y ,int r, int max ){
this.x = x ;
this.y = y;
this.r = r;
maxRadius = max;
}
public boolean update () {
r += 2;
if (r >= maxRadius) {
return true;
}
return false;
}
public void draw (Graphics2D g ){
g.setColor (new Color ( 255, 255,255, 128) );
g.setStroke(new BasicStroke(3));
g.drawOval ((int) ( x - r) , (int) (y - r) , 2 * r ,2 * r);
g.setStroke(new BasicStroke(1));
}
}