⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blood.java

📁 一个坦克游戏程序
💻 JAVA
字号:
package com.tankwar;


import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

public class Blood {
	
	int x,y,w,h;
	
	TankClient tc = null;
	
	private boolean live =true;
	
	int step = 0;
	
	int [] [] pos = { {300,350},{300,360},{320,380},{330,321},
			{340,307},{350,320},{370,150},{370,200},{150,350},{370,300}};
	
	public Blood() {
		x = pos[0][0];
		y = pos[0][1];
		w = 13;
		h = 13;
	}
	
	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;
	}
	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -