-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExplosion.pde
More file actions
47 lines (44 loc) · 1.01 KB
/
Copy pathExplosion.pde
File metadata and controls
47 lines (44 loc) · 1.01 KB
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
45
46
47
class Explosion
{
float x, y;
int counter;
float offX1, offY1, offX2, offY2, offX3, offY3;
public Explosion( float x, float y )
{
this.x = x;
this.y = y;
counter = 0;
offX1 = random(-25,25);
offY1 = random(-25,25);
offX2 = random(-25,25);
offY2 = random(-25,25);
offX3 = random(-25,25);
offY3 = random(-25,25);
}
public boolean drawExplosion() //returns true when finished
{
counter+=2;
noStroke(); //<>//
if(counter < 30)
{
fill(200-counter*2,100,0);
ellipse(x+offX1,y+offY1,5+counter,5+counter);
}
if(counter >= 10 && counter < 40)
{
fill(200-(counter-10)*2,100,0);
ellipse(x+offX2,y+offY2,5+(counter-10),5+(counter-10));
}
if(counter >= 20 && counter < 50)
{
fill(200-(counter-20)*2,100,0);
ellipse(x+offX3,y+offY3,5+(counter-20),5+(counter-20));
}
if(counter >= 50)
return true;
return false;
}
}
// first burst - 0 -> 30
//second burst- 10 -> 40
// third burst- 20 -> 50