📄 blood.java
字号:
package game;
import java.awt.*;
public class Blood {
int x,y,w,h;
int step=0;
private boolean alive=true;
private int [][]position={
{350,275},{360,285},{370,295},{380,315},{390,325},{400,325},{410,335},{420,345}
};
public Blood(){
x=position[0][0];
y=position[0][1];
w=h=15;
}
void draw(Graphics g){
if(!alive) return;
Color c=g.getColor();
g.setColor(Color.PINK);
g.fillOval(x, y, w, h);
g.setColor(c);
move();
}
private void move() {
step++;
if(step==position.length){
step=0;
}
x=position[step][0];
y=position[step][1];
}
public Rectangle getRect(){
return new Rectangle(x,y,w,h);
}
public boolean isAlive() {
return alive;
}
public void setAlive(boolean alive) {
this.alive = alive;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -