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

📄 tanksprite.java

📁 此为一款基于J2ME的手机游戏
💻 JAVA
📖 第 1 页 / 共 2 页
字号:

	/*获取坦克主炮的名称*/
	public static String getMainName() {

		return mainName;
	}

	/*获取坦克主炮的状态*/
	public static int getMainState() {

		return mainState;
	}

	/*获取坦克副炮的攻击力*/
	public static int getViceAt() {

		return viceAt;
	}

	/*获取坦克副炮的防御力*/
	public static int getViceDf() {

		return viceDf;
	}

	/*获取坦克副炮的弹药数,为无限,省略
	public static int getViceNum(){

		return viceNum; 
	}*/

	/*获取坦克副炮的重量*/
	public static int getViceWei() {

		return viceWei;
	}

	/*获取坦克副炮的名称*/
	public static String getViceName() {

		return viceName;
	}

	/*获取坦克副炮的状态*/
	public static int getViceState() {

		return viceState;
	}

	/*获取坦克SE的攻击力*/
	public static int getSeAt() {

		return seAt;
	}

	/*获取坦克SE的防御力*/
	public static int getSeDf() {

		return seDf;
	}

	/*获取坦克SE的现有弹药数*/
	public static int getSeNum() {

		return seNum;
	}

	/*获取坦克SE的最大弹药数*/
	public static int getSeMaxNum() {

		return seMaxNum;
	}

	/*获取坦克SE的重量*/
	public static int getSeWei() {

		return seWei;
	}

	/*获取坦克SE的名称*/
	public static String getSeName() {

		return seName;
	}

	/*获取坦克SE的状态*/
	public static int getSeState() {

		return seState;
	}

	/*获取坦克C装置的防御力*/
	public static int getCmDf() {

		return cmDf;
	}

	/*获取坦克C装置的重量*/
	public static int getCmWei() {

		return cmWei;
	}

	/*获取坦克C装置的名称*/
	public static String getCmName() {

		return cmName;
	}

	/*获取坦克C装置的状态*/
	public static int getCmState() {

		return cmState;
	}

	/*获取坦克发动机的防御力*/
	public static int getMotDf() {

		return motDf;
	}

	/*获取坦克发动机的重量*/
	public static int getMotWei() {

		return motWei;
	}

	/*获取坦克发动机的名称*/
	public static String getMotName() {

		return motName;
	}

	/*获取坦克发动机的载重量*/
	public static int getMotCa() {

		return motCa;
	}

	/*获取坦克发动机的状态*/
	public static int getMotState() {

		return motState;
	}

	/*获取坦克地盘的防御力*/
	public static int getBedRockDf() {

		return bedrockDf;
	}

	/*获取坦克地盘的现有弹药数(限特殊炮弹)*/
	public static int getBedRockNum() {

		return bedNum;
	}

	/*获取坦克地盘的最大弹药数(限特殊炮弹)*/
	public static int getBedRockMaxNum() {

		return bedMaxNum;
	}

	/*获取坦克地盘的重量*/
	public static int getBedRockWei() {

		return bedrockWei;
	}

	/*获取坦克地盘的名称*/
	public static String getBedRockName() {

		return bedrockName;
	}

	/*获取坦克地盘的状态*/
	public static int getBedRockState() {

		return bedrockState;
	}

	/*获取坦克地盘的现有装甲量*/
	public static int getTankSp() {

		return sp;
	}

	/*获取坦克地盘的最大装甲量*/
	public int getTankMaxSp() {

		maxSp = di;

		return maxSp;
	}

	/*获取坦克地盘的现有重量*/
	public int getTankNw() {

		nw = getMainWei() + getViceWei() + getSeWei() + getMotWei()
				+ getCmWei() + getBedRockWei();

		return nw;
	}

	/*获取坦克地盘的最大承载量*/
	public int getTankMax() {

		max = getMotCa();

		return max;
	}
	
	/*获取坦克的剩余承载量*/
	public int getTankDi() {

		di = max - nw;

		return di;

	}

	/*获取坦克的名称*/
	public String getTankName() {

		return tankName;
	}

	/*获取坦克的现有工具*/
	public int[] getTankItem() {

		return tankItem;
	}

	/*获取坦克的现有装备*/
	public int[] getTankEquItem() {

		return tankEquItem;
	}

	/*获取坦克已装备的战车装备*/
	public int[] getTankEqu() {

		return tankEqu;
	}

	/*获取坦克的状态*/
	public int getTankState() {

		return tankState;
	}

	/*--------------------物品处理-----------------------------*/

	/*坦克装备物品,设置相应的数组位(对应于坦克装备类型)为坦克装备的编号*/
	public void addTankEqu(int equItemID, int type) {

		tankEqu[type] = equItemID;

	}

	/*增加坦克工具*/
	public void addTankItem(int itemID) {

		/*找到坦克工具数组中为0的项,更新为增加的物品编号*/
		for (int i = 0; i < tankItem.length; i++) {

			if (tankItem[i] == 0) {

				tankItem[i] = itemID;
			}
		}

	}

	/*删除坦克工具*/
	public void delTankItem(int itemID) {

		/*找到坦克工具数组中值相等的项,设置为0*/
		for (int i = 0; i < tankItem.length; i++) {

			if (tankItem[i] == itemID) {

				tankItem[i] = 0;
			}

		}
	}

	/*增加坦克装备*/
	public void addTankEquItem(int equItemID) {

		for (int i = 0; i < tankEquItem.length; i++) {

			if (tankEquItem[i] == 0) {

				tankEquItem[i] = equItemID;
			}
		}

	}

	/*删除坦克装备*/
	public void delTankEquItem(int equItemID) {

		for (int i = 0; i < tankEquItem.length; i++) {

			if (tankEquItem[i] == equItemID) {

				tankEquItem[i] = 0;
			}

		}
	}

	/*更新坦克坐标*/
	public void setXY(int pX, int pY) {

		this.pX = pX;
		this.pY = pY;
	}

	/*************************************************
	Function: moveUp(boolean)
	
	Description: 坦克精灵向上移动的方法
	
	Calls: setFreameSequenve(int[]),nextFrame(),move(int,int).
	
	Called By: MetalMaxCanvas.java
	
	Input: doit:是否真正移动,碰撞检测时会用到.
	
	Output: 无
	
	Return: 无
	
	Others: 无
	*************************************************/
	
	public void moveUp(boolean doit) throws IOException {

		if (mDir != UP) {

			mDir = UP;
			setFrameSequence(nowup);
		}

		nextFrame();

		if (doit) {

			move(0, -mSpeed);
		} else {

			move(0, mSpeed);
		}

		this.pY = Math.max(0, pY - mSpeed);

	}

	/*坦克向下移动方法*/
	public void moveDown(boolean doit) throws IOException {

		if (mDir != DOWN) {

			mDir = DOWN;
			setFrameSequence(nowdown);
		}

		nextFrame();

		if (doit) {

			move(0, mSpeed);
		} else {

			move(0, -mSpeed);
		}

		this.pY = Math.min(screenHeight, pY + mSpeed);

	}

	/*坦克向左移动方法*/
	public void moveLeft(boolean doit) throws IOException {

		if (mDir != LEFT) {

			mDir = LEFT;
			setFrameSequence(nowleft);
		}

		nextFrame();

		if (doit) {

			move(-mSpeed, 0);
		} else {

			move(mSpeed, 0);
		}

		this.pX = Math.max(0, pX - mSpeed);

	}

	/*坦克向右移动方法*/
	public void moveRight(boolean doit) throws IOException {

		if (mDir != RIGHT) {

			mDir = RIGHT;
			setFrameSequence(nowright);
		}

		nextFrame();

		if (doit) {

			move(mSpeed, 0);
		} else {

			move(-mSpeed, 0);
		}

		this.pX = Math.min(screenWidth, pX + mSpeed);

	}

}

⌨️ 快捷键说明

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