-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExplosion.java
More file actions
44 lines (40 loc) · 1009 Bytes
/
Explosion.java
File metadata and controls
44 lines (40 loc) · 1009 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
35
36
37
38
39
40
41
42
43
44
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* The class for the explosions, when the artilary fires
*
* @author James Lu
* @version 1.0
*/
public class Explosion extends Effects
{
private int trans; //transparancy
public Explosion(int aoe){
bg = new GreenfootImage (aoe, aoe);
bg.setColor (Color.RED);
bg.fillOval(0, 0, aoe, aoe);
trans = 190;
show = true;
this.setImage (blank);
}
public void act(){
if (show){
if (counter >= 2){
counter = 0;
trans -= 30;
if (trans >= 0){
bg.setTransparency (trans);
}
else{
m.removeObject (this);
}
}
else{
counter++;
}
this.setImage (bg);
}else{
this.setImage (blank);
}
}
}