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

📄 steelwall.java

📁 java坦克大战
💻 JAVA
字号:
import java.awt.*;

public class Steelwall implements Actor{
	public final String Type = "Steelwall";
	public Image Steelwall;
	public int xPos;
	public int yPos;
	public boolean[] shape;
	public ClientModel gameModel;

	public  Steelwall(int xPos, int  yPos, int orientation,  ClientModel gameModel){
		this.xPos = xPos;
		this.yPos = yPos;
		this.gameModel = gameModel;
		shape = new boolean[4];
		Steelwall = gameModel.textures[53];

		if(orientation == 0){
				shape[2] = true;
				shape[3] = true;
		}
		if(orientation == 1){
				shape[0] = true;
				shape[1] = true;
		}
		if(orientation == 2){
				shape[1] = true;
				shape[3] = true;
		}
		if(orientation == 3){
				shape[0] = true;
				shape[2] = true;
		}
	}

	public void draw(Graphics g){
		boolean walldestoried = true;
		for(int i = 0; i < shape.length; i++)
			if(!shape[i]){
				walldestoried = false;
				break;
			}
		if(walldestoried)
			return;

		g.drawImage(Steelwall, xPos - 12, yPos - 12, null);
		g.setColor(new Color(128, 64, 0));
		if(shape[0])
			g.fillRect(xPos - 12, yPos - 12, 13, 13);
		if(shape[1])
			g.fillRect(xPos, yPos - 12, 13, 13);
		if(shape[2])
			g.fillRect(xPos - 12, yPos, 13, 13);
		if(shape[3])
			g.fillRect(xPos, yPos, 13, 13);
	}

	public int getxPos(){
		return xPos;
	}

	public int getyPos(){
		return yPos;
	}

	public String getType(){
		return Type;
	}

}

⌨️ 快捷键说明

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