?? blood.java
字號(hào):
package com.bjsxt.tank;
import java.awt.*;
public class Blood {
int x, y, w, h;
TankClient tc;
int step = 0;
private boolean live = true;
//指明血塊運(yùn)動(dòng)的軌跡,由pos中各個(gè)點(diǎn)構(gòu)成
private int[][] pos = {
{350, 300}, {360, 300}, {375, 275}, {400, 200}, {360, 270}, {365, 290}, {340, 280}
};
public Blood() {
x = pos[0][0];
y = pos[0][1];
w = h = 15;
}
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);
move();
}
private 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);
}
public boolean isLive() {
return live;
}
public void setLive(boolean live) {
this.live = live;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -