?? tanksprite.java
字號:
/*獲取坦克主炮的名稱*/
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 + -