-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlood.java
More file actions
48 lines (40 loc) · 1.2 KB
/
Copy pathBlood.java
File metadata and controls
48 lines (40 loc) · 1.2 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
package com.Tank;
import java.awt.*;
public class Blood {
int x , y , w , h;
TankClient tc;
private int[][] pos = { {100,120} ,{270,220} ,{480,320} ,{330,500} ,{640,120} ,{240,400} ,{750,320}
};
private int step = 0;
private boolean live = true;
public Blood() {
x = pos[0][0];
y = pos[0][1];
w=h=15;
}
public boolean isLive() {
return live;
}
public void setLive(boolean live) {
this.live = live;
}
public void draw(Graphics g) {
if(!live)
return;
Color c = g.getColor();
g.setColor(Color.MAGENTA);
g.fillRect(x, y, w, h);
g.setColor(c);
}
public void move() {
step++;
if(step==pos.length) {
step=0;
}
x = pos[step][0];
y = pos[step][1];
}
public Rectangle getRect() {
return new Rectangle(x , y ,w,h);
}
}