-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExplosion.java
More file actions
63 lines (55 loc) · 1.37 KB
/
Explosion.java
File metadata and controls
63 lines (55 loc) · 1.37 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.awt.*;
import java.net.*;
// This contains the images of the explosions and all the methods to do with
// them.
public class Explosion extends Movable
{
private Image[] images = new Image[3];
private Boolean exploding = false;
private int imageIndex = 0;
private ExplosionThread thethread;
// At the start, the three explosions are loaded into memory
Explosion()
{
images[0] = readImage("img/UI/exp1.png");
images[1] = readImage("img/UI/exp2.png");
images[2] = readImage("img/UI/exp3.png");
}
public void makeExplosion( int bin )
{
switch( bin )
{
case 0:
xPos = 142;
break;
case 1:
xPos = 260;
break;
case 2:
xPos = 375;
break;
case 3:
xPos = 495;
break;
}
yPos = 160;
exploding = true;
thethread = new ExplosionThread(this);
thethread.start();
}
public void endExplosion()
{
exploding = false;
setSize( 0, 0 );
}
public void changeExplosion()
{
myimage = images[imageIndex];
setImageSize();
makeTheMove();
if ( imageIndex == 2 )
imageIndex = 0;
else
imageIndex++;
}
}