freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

坦克大戰(zhàn)設(shè)計與實(shí)現(xiàn)-資料下載頁

2025-06-29 23:03本頁面
  

【正文】 g) { ()。 (x, y TANK_HEIGHT/6, kingLife, TANK_HEIGHT/6)。 ()。 (x, y TANK_HEIGHT/6, TANK_WIDTH + TANK_WIDTH/6, TANK_HEIGHT/6)。 } } else { ()。 (x, y TANK_HEIGHT/6, life, TANK_HEIGHT/6)。 ()。 (x, y TANK_HEIGHT/6, TANK_WIDTH + TANK_WIDTH/6, TANK_HEIGHT/6)。 } //把原來的顏色還原回去,做到使用后而不改變畫筆顏色 (c)。 /* * 按坦克方向來畫出相應(yīng)方向的炮筒 */ switch (ptDir) { case L: (tankImgs[0], x, y, null)。 break。 case LU: (tankImgs[1], x, y, null)。 break。 case U: (tankImgs[2], x, y, null)。 break。 case RU: (tankImgs[3], x, y, null)。 break。 case R: (tankImgs[4], x, y, null)。 break。 case RD: (tankImgs[5], x, y, null)。 break。 case D: (tankImgs[6], x, y, null)。 break。 case LD: (tankImgs[7], x, y, null)。 break。 } move()。 } /** * 按下方向鍵,則相應(yīng)的變量置為true來記錄下來 * @param e 鍵盤事件(按下) */ public void keyPressed(KeyEvent e) { int i = ()。 switch (i) { case : bU = true。 break。 case : bD = true。 break。 case : bL = true。 break。 case : bR = true。 break。 } locateDirection()。 } /** * 不按任何方向鍵,則方向變量均為false * 按A,發(fā)起超級攻擊 * 按control,發(fā)射普通子彈 * 按L,復(fù)活并滿血 * @param e 鍵盤事件(抬起) */ public void keyReleased(KeyEvent e) { int i = ()。 switch (i) { case : fire()。 break。 case : superFire()。 break。 case : setLive(true)。 setLife(TANK_WIDTH)。 break。 case : bU = false。 break。 case : bD = false。 break。 case : bL = false。 break。 case : bR = false。 break。 case : ()。 break。 case : ()。 break。// case :// ()。// break。 } locateDirection()。 } /** * 實(shí)現(xiàn)八個方向的關(guān)鍵方法,判定按下哪幾個鍵是什么方向 */ public void locateDirection() { if (bU amp。amp。 !bD amp。amp。 !bL amp。amp。 !bR) { dir = 。 } else if (!bU amp。amp。 bD amp。amp。 !bL amp。amp。 !bR) { dir = 。 } else if (!bU amp。amp。 !bD amp。amp。 bL amp。amp。 !bR) { dir = 。 } else if (!bU amp。amp。 !bD amp。amp。 !bL amp。amp。 bR) { dir = 。 } else if (bU amp。amp。 !bD amp。amp。 bL amp。amp。 !bR) { dir = 。 } else if (!bU amp。amp。 bD amp。amp。 bL amp。amp。 !bR) { dir = 。 } else if (bU amp。amp。 !bD amp。amp。 !bL amp。amp。 bR) { dir = 。 } else if (!bU amp。amp。 bD amp。amp。 !bL amp。amp。 bR) { dir = 。 } else if (!bU amp。amp。 !bD amp。amp。 !bL amp。amp。 !bR) { dir = 。 } } /** * 坦克移動 */ public void move() { /* * 八個方向的移動 */ switch (dir) { case U: y = TSPEED。 break。 case D: y += TSPEED。 break。 case L: x = TSPEED。 break。 case R: x += TSPEED。 break。 case LU: y = TSPEED。 x = TSPEED。 break。 case RU: y = TSPEED。 x += TSPEED。 break。 case LD: y += TSPEED。 x = TSPEED。 break。 case RD: y += TSPEED。 x += TSPEED。 break。 } /* * 使炮筒方向與坦克移動方向一致 */ if ( != ) { = 。 } /* * 解決坦克出界問題(使坦克始終在窗口內(nèi),不至于跑到看不見的地方) */ if (x 0) x = 0。 if (y 28) y = 28。 if (x ) x = 。 if (y ) y = 。 /* * 坦克撞墻后還原為撞墻前的坐標(biāo) */ if (().intersects(()) || ().intersects(())) { x = oldX。 y = oldY。 } /* * 敵方(電腦)坦克的自主移動的實(shí)現(xiàn) */ if (!good) { /* * step逐漸減至零,然后換下一個方向 */ if (step == 0) { step = (15) + 5。 //轉(zhuǎn)換成數(shù)組形式,便于引用 Direction[] dirs = ()。 int rn = ()。 dir = dirs[rn]。 } step。 /* * boss坦克的發(fā)彈頻率和攻擊類型都比較狠,呵呵 */ if(king) { if ((40) 33) ()。 } if ((40) 38) ()。 } /* * 記錄舊坐標(biāo),以便撞墻后還原 */ oldX = x。 oldY = y。 } /** * 普通攻擊,打出一發(fā)子彈 * */ public Bullet fire() { if (!live) return null。 Bullet b = null。 b = new Bullet(x + 15, y + 15, ptDir, , good)。 //當(dāng)即將這顆新子彈添加進(jìn)裝“子彈”的容器 (b)。 return b。 } /** * 超級攻擊,同時向八個方向發(fā)射子彈 * 但是實(shí)際上該方法的返回值只是一發(fā)子彈,也就是說超級攻擊是看似同時發(fā)射,實(shí)則按序列發(fā)射 */ public Bullet superFire() { if (!live) return null。 Direction[] dirs = ()。 Bullet b = null。 /* * 當(dāng)然,是子彈都要添加進(jìn)子彈的容器的 */ for(int i = 0。i 8。 i++) { b = new Bullet(x + 10, y + 10, dirs[i], , good)。 (b)。 } return b。 } /** * 如果我方坦克與敵人的坦克相撞。全撞死啦~ * @param t 被撞的坦克 * @return 撞上了返回true,否則返回false */ public boolean tankHitTank(Tank t) { if ( amp。amp。 ().intersects(()) amp。amp。 () amp。amp。 != ()) { /* * 雙雙爆炸 */ = false。 (false)。 += 1。 (new Explode((), (), tc))。 (new Explode((), (), tc))。 return true。 } return false。 } /** * 碰撞檢測,得先把對象的矩形都拿到 * @return 坦克的矩形范圍 */ public Rectangle getRect() { return new Rectangle(x, y, TANK_WIDTH, TANK_HEIGHT)。 } public boolean isLive() { return live。 } public void setLive(boolean live) { = live。 } public int getX() { return x。 } public int getY() { return y。 } public static int getTANK_WIDTH() { return TANK_WIDTH。 } public static int getTANK_HEIGHT() { return TANK_HEIGHT。 } public boolean isGood() { return good。 } public int getLife() { return life。 } public void setLife(int life) { = life。 } public boolean isKing() { return king。 } public int getKingLife() { return kingLife。 } public void setKingLife(int kingLife) { = kingLife。 } public void setX(int x) { = x。 } public void setY(int y) { = y。 }}package 。import .*。import 。import 。import 。public class Bullet { //子彈的位置 private int bx = 120, by = 120。 //子彈的大?。o態(tài)常量) private static final int B_WIDTH = 10,B_HEIGHT = 10。 //子彈速度(靜態(tài)常量) private static final int BSPEED = 15。 //子彈是否健在 private boolean live = true。 //子彈的移動方向 Direction bDir。 //取得大管家的引用 private TankWarClient tc。 //子彈是誰發(fā)射的,我方還是敵方,我方good == true private boolean good = true。 //將使用Toolkit中的方法把硬盤上的圖片拿到內(nèi)存里來 private static Toolkit tk =
點(diǎn)擊復(fù)制文檔內(nèi)容
研究報告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1