亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? battlefield.java

?? 還記得兒時在游戲機上玩坦克大戰嗎?如今這種經典游戲不在游戲機上玩了
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
            }
        }
         return bRet;
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Initialize the Enemy's start position.
     * @param tank the Enemy's tank.
     */
    public void initEnemyTankPos(EnemyTank tank){
        nextEnemyPos%=3;
        int x=enemyPos[nextEnemyPos][0];
        int y=enemyPos[nextEnemyPos][1];
        tank.setPosition(x,y);
        nextEnemyPos++;
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * read battle field from HZK.
     * @param gameLevel the current game level.
     */
    public void readBattlefieldFromHZK(int gameLevel){
        InputStream is=this.getClass().getResourceAsStream("/hzk12");
        int []buffer=new int[24];
        int []hzData=new int[13*13+4];
        int index=0;
         try{
             is.skip(gameLevel*24);
             for(int i=0;i<24;i++) buffer[i]=is.read();
             int tempChar;
             int tempBit;;
             index=0;
             for(int i=0;i<12;i++){
                 for(int j=0;j<2;j++){
                     tempChar=buffer[i*2+j];
                     tempBit=0x80;
                     for(int k=0;k<8;k++){
                         if(j==1 && k>3) break;
                         if((tempBit & tempChar)!=0){
                             hzData[index++]='2';
                         }else{
                             hzData[index++]='0';
                         }
                         tempBit=tempBit>>1;
                     }
                 }
                 hzData[index++]='0';
                 hzData[index++]='\n';
             }
            byte[] byteArray=new byte[hzData.length];
            for(int i=0;i<byteArray.length;i++){
                byteArray[i]=(byte)hzData[i];
            }
            ByteArrayInputStream bais=new ByteArrayInputStream(byteArray);       
            
            initBattlefield(bais);
        }catch(Exception e){
            //inglore the exception.
        }
    }
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Initialize the player's start position.
     * @param tank the player's tank.
     */
    public void initPlayerTankPos(PlayerTank tank){
        int x=(WIDTH_IN_TILES/4-2)*ResourceManager.TILE_WIDTH;
        int y=(HEIGHT_IN_TILES/2-1)*ResourceManager.TILE_WIDTH;
        //this place will be placed with player's tank.
        duplicateCell(x*2/ResourceManager.TILE_WIDTH,
                y*2/ResourceManager.TILE_WIDTH,0);
        tank.setPosition(x,y);
        
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Initialize the powerup's random start position. 
     * @param powerup the powerup object.
     */
    public void initPowerupPos(Powerup powerup){
        if(powerup.getType()==Powerup.HOME ||
                powerup.getType()==Powerup.HOME_DESTROYED){
            int x=(WIDTH_IN_TILES/4)*ResourceManager.TILE_WIDTH;
            int y=(HEIGHT_IN_TILES/2-1)*ResourceManager.TILE_WIDTH;
            powerup.setPosition(x,y);
        }else{
            int x0=(WIDTH_IN_TILES/4)*ResourceManager.TILE_WIDTH;
            int y0=(HEIGHT_IN_TILES/2-1)*ResourceManager.TILE_WIDTH;
            int x=(Math.abs(rnd.nextInt()) % (WIDTH_IN_TILES/2))
                                                *ResourceManager.TILE_WIDTH;
            int y=(Math.abs(rnd.nextInt()) % (WIDTH_IN_TILES/2))
                                                *ResourceManager.TILE_WIDTH;
            //aovid the home cell.
            while(x==x0 && y==y0){
                x=(Math.abs(rnd.nextInt()) % (WIDTH_IN_TILES/2))
                                                *ResourceManager.TILE_WIDTH;
                y=(Math.abs(rnd.nextInt()) % (WIDTH_IN_TILES/2))
                                                *ResourceManager.TILE_WIDTH;
            }
            powerup.setPosition(x,y);
        }
        
    }
    
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Make home wall a concrete wall. 
     */
    public void makeHomeConcreteWall(){
        //Draw the player's home area.
        for(int i=0;i<6;i++){
            for(int j=0;j<4;j++){
               setCell(i+(WIDTH_IN_TILES/2-3), HEIGHT_IN_TILES-4+j, CONCRETE_WALL);
            }
        }
        //this place will be placed with player's flag.
        duplicateCell((WIDTH_IN_TILES-2)/2,HEIGHT_IN_TILES-2,0);
        concreteWallStartTime=System.currentTimeMillis();
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Read the battle from an input stream.
     * @param is input stream stores the battle field information.
     */
    public synchronized void initBattlefield(java.io.InputStream is) 
                                                        throws IOException {
        //The actually canvas can be larger than 13X13 . initialiaze the battle
        //field with some random value.
        Random rnd=new Random();
        for(int i=0;i<WIDTH_IN_TILES;i+=2){
            for(int j=0;j<HEIGHT_IN_TILES;j+=2){
                int value=Math.abs(rnd.nextInt()) % 24;
                if(value>17){
                    if(value==21 || value==22){
                        duplicateCell(i,j,-1 - ((i ^ j) & 1));
                    }else{
                        duplicateCell(i, j, value-17);
         
                    }
                }else{
                   duplicateCell(i,j,0);
                }
            }
        }
        try{
            if(is!=null){
                readBattlefield(is);
            }
        }catch(IOException e){}
        makeHomeBrickWall();
        
    }
       
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * @InheritDoc
     */
    public void tick() {
        int tickState = (tickCount++ >> 3); // slow down x8
        int tile = tickState % 2;
        setAnimatedTile(-1 - tile, waterFrames[tile][(tickState % 4) / 2]);
        if(concreteWallStartTime>0){
            long tickTime=System.currentTimeMillis();
            if(tickTime-concreteWallStartTime>concreteWallPeriod){
                makeHomeBrickWall();
                concreteWallStartTime=0;
            }
        }
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Make home wall a brick wall. 
     */
    private void makeHomeBrickWall(){
       //Draw the player's home area.
        for(int i=0;i<6;i++){
            for(int j=0;j<4;j++){
               setCell(i+(WIDTH_IN_TILES/2-3), HEIGHT_IN_TILES-4+j, BRICK_WALL);
            }
        }
        //this place will be placed with player's flag.
        duplicateCell((WIDTH_IN_TILES-2)/2,HEIGHT_IN_TILES-2,0);
        concreteWallStartTime=0;
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * duplicate adjacent cell with given value. The reason for this ,the width
     * for each image tile is 6X6 ,when design the battle fields, for simplicity
     * we combine adjacent 2X2 cell to stand for a 12X12 area,i.e the 4 cells 
     * store the same value.
     * @param x the x index of the cell
     * @param y the y index of the cell
     * @param value the value for the cell
     */
    private void duplicateCell(int x,int y,int value){
        int maxCols=getColumns()-1;
        int maxRows=getRows()-1;
        if(x<0 || x>maxCols || y<0 || y>maxRows ) 
            return;
        setCell(x, y, value);
        setCell(x+1, y, value);
        setCell(x, y+1, value);
        setCell(x+1, y+1, value);
     }
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 16JAN2008  James Shen                 	          Initial Creation
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Read the battle from an input stream.
     * @param is input stream stores the battle field information.
     */
    private void readBattlefield(java.io.InputStream is) throws IOException {
        int c = -1;
        int x0 = (WIDTH_IN_TILES-NUMBER_IN_TILES)/2;
        int y0 = (HEIGHT_IN_TILES-NUMBER_IN_TILES)/2;
        int x=0,y=0;
        while ((c = is.read()) != -1 && y < NUMBER_IN_TILES) {
            switch (c) {
                case ' '://empty
                case '0':
                    duplicateCell(x+x0, y+y0, 0);x+=2;
                    break;
                case '1'://snow field
                    duplicateCell(x+x0, y+y0,SNOW);x+=2;
                    break;
                case '2'://brick wall
                    duplicateCell(x+x0, y+y0, BRICK_WALL);x+=2;
                    break;
                case '3'://forest
                    duplicateCell(x+x0, y+y0, FOREST);x+=2;
                    break;
                case '4':
                case '5'://water
                    duplicateCell(x+x0, y+y0, -1 - ((x ^ y) & 1));x+=2;
                    break;
                case '6': //Concrete wall
                    duplicateCell(x+x0, y+y0, CONCRETE_WALL);x+=2;
                    break;
                case '\n'://new line
                    y+=2;
                    x = 0;
                    break;
                default:
            }
        }
    }
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲人123区| 欧美另类高清zo欧美| 91精品福利视频| 久久久久久久久岛国免费| 亚洲一二三区在线观看| 国产91精品免费| 日韩欧美不卡在线观看视频| 亚洲综合丁香婷婷六月香| 国产成人精品影视| 欧美电影免费观看高清完整版在 | 国产精品影视在线| 欧美日韩视频在线观看一区二区三区 | 色哟哟日韩精品| 国产亚洲一区二区三区在线观看| 五月天婷婷综合| 91福利小视频| 亚洲品质自拍视频网站| 成人午夜视频在线观看| 精品国产99国产精品| 奇米影视7777精品一区二区| 欧美亚洲国产一区在线观看网站| 国产精品久久久爽爽爽麻豆色哟哟 | 白白色 亚洲乱淫| 久久女同精品一区二区| 久久99精品国产| 精品99一区二区| 极品美女销魂一区二区三区| 日韩一级大片在线| 免费观看久久久4p| 欧美大尺度电影在线| 久久成人av少妇免费| 日韩三级在线免费观看| 日韩av高清在线观看| 在线播放中文字幕一区| 日本不卡的三区四区五区| 91精品国产高清一区二区三区| 亚洲高清免费视频| 91精品国产欧美日韩| 老司机精品视频在线| 中文字幕在线观看不卡视频| 国产一区二区精品久久99| 欧美激情综合五月色丁香| 99re成人在线| 亚洲一区在线观看免费| 欧美日韩国产在线观看| 青青草国产精品亚洲专区无| 精品国产电影一区二区 | 日本美女一区二区三区| 精品奇米国产一区二区三区| 国产乱码精品一区二区三区忘忧草 | 日韩精品一区二区三区在线| 精彩视频一区二区| 中文字幕一区二区三区视频 | 国产a区久久久| 亚洲精品国产精华液| 欧美做爰猛烈大尺度电影无法无天| 亚洲美女视频在线观看| 欧美另类z0zxhd电影| 国产一区免费电影| 伊人夜夜躁av伊人久久| 91精品国产一区二区三区蜜臀| 久久99精品一区二区三区| 国产精品福利影院| 欧美美女bb生活片| 成人午夜短视频| 午夜精品一区二区三区电影天堂| 精品播放一区二区| 欧洲精品在线观看| 国产成人免费视频网站高清观看视频| 亚洲欧洲性图库| 日韩一区二区免费电影| 成人爱爱电影网址| 午夜精品久久久久久久久久久 | 成人深夜福利app| 亚洲国产aⅴ天堂久久| 久久夜色精品国产噜噜av| 日本久久一区二区| 国产乱码精品一品二品| 亚洲一区二区精品3399| 欧美经典一区二区| 欧美电影一区二区| 色婷婷综合久久久| 国内精品国产三级国产a久久| 一区二区三区高清在线| 国产亚洲综合av| 日韩视频免费观看高清完整版在线观看 | 91丨porny丨国产入口| 另类小说图片综合网| 艳妇臀荡乳欲伦亚洲一区| 国产日产亚洲精品系列| 欧美大尺度电影在线| 91麻豆精品久久久久蜜臀 | 亚洲国产一区二区a毛片| 国产日产欧产精品推荐色 | 亚洲免费视频成人| 久久久www免费人成精品| 91精品国产入口| 99国产精品国产精品久久| 国产成人欧美日韩在线电影| 日韩精品91亚洲二区在线观看| 国产精品国产三级国产有无不卡| 日韩欧美www| 欧美一二区视频| 3atv一区二区三区| 欧美精品v日韩精品v韩国精品v| 91福利在线免费观看| 99热精品一区二区| 成人听书哪个软件好| 国产黄色成人av| 国产一区二区三区香蕉| 国产一区欧美二区| 国产成人综合视频| 粉嫩13p一区二区三区| 风间由美性色一区二区三区| 国产精品伊人色| 国产91精品在线观看| 成人avav影音| 不卡的av在线播放| 91丝袜高跟美女视频| 91免费观看视频在线| 91片在线免费观看| 欧美在线free| 欧美日韩国产小视频| 欧美一区二区三区视频| 欧美日韩aaa| 日韩欧美国产综合一区| xfplay精品久久| 国产精品嫩草影院com| 国产精品久久三| 亚洲午夜视频在线| 久久爱www久久做| 国产成人综合亚洲91猫咪| 色综合中文综合网| 中文字幕在线播放不卡一区| 亚洲精品免费在线| 日韩avvvv在线播放| 国产一区二区三区免费看| 成人国产一区二区三区精品| 欧洲视频一区二区| 精品免费99久久| 最好看的中文字幕久久| 午夜精品久久久久久久99樱桃| 美国毛片一区二区| 不卡一区二区三区四区| 欧美日韩一区二区三区在线 | 亚洲人午夜精品天堂一二香蕉| 亚洲一区二区三区四区五区黄| 麻豆成人在线观看| av高清久久久| 欧美大片日本大片免费观看| 欧美激情艳妇裸体舞| 日韩制服丝袜av| 粉嫩一区二区三区性色av| 欧美日韩色综合| 国产欧美精品在线观看| 五月婷婷久久丁香| caoporm超碰国产精品| 制服丝袜av成人在线看| 国产精品久久久久久久久久久免费看| 亚洲第四色夜色| 国产精品18久久久久久久久久久久 | 成人av在线资源网站| 欧美一区二区网站| 亚洲欧美电影院| 韩日精品视频一区| 欧美高清视频不卡网| 亚洲国产高清在线观看视频| 免费观看日韩av| 欧美在线色视频| 亚洲视频每日更新| 国产成人丝袜美腿| 3751色影院一区二区三区| 一区二区三区在线视频观看| 国产电影一区二区三区| 日韩视频在线观看一区二区| 亚洲综合免费观看高清完整版在线 | 欧美性猛交一区二区三区精品| 欧美精品一区二区三| 日韩在线a电影| 欧美探花视频资源| 日韩毛片精品高清免费| 国产成人激情av| 久久精品一区二区| 久久精品国产精品亚洲红杏| 欧美日韩国产一二三| 亚洲五月六月丁香激情| 色婷婷综合久久久| 亚洲欧美另类久久久精品| 成人h动漫精品| 国产日产欧美精品一区二区三区| 国产一区二区三区在线观看免费视频| 制服丝袜在线91| 日本午夜一区二区| 欧美一区二区私人影院日本| 日本va欧美va瓶| 欧美一区二区三区免费| 蜜桃免费网站一区二区三区| 日韩丝袜美女视频| 国产在线一区观看| 国产欧美一区二区精品性色超碰|