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

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

?? world.java

?? 大量j2me源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
   }

   public final byte getTile(int x, int y)
   {
      int tx = getTileAtX(x);
      int ty = getTileAtY(y);
      if (tx < 0 || tx >= tilesWide || ty < 0 || ty >= tilesHigh) return -1;
      return tileMap[y / TILE_WIDTH][x / TILE_WIDTH];
   }


   public final void render(Graphics g)
   {
      try
      {
// Draw a star field scrolling 10 times slower than the view.
         if (StarAssault.getApp().isOptionStarField())
            Tools.drawStarField(g, viewX / 10, viewY / 10, viewWidth, viewHeight);

         // draw all the tiles
         int startX = (viewX / TILE_WIDTH) - 1;
         int startY = (viewY / TILE_HEIGHT) - 1;
         int endTileX = ((Math.abs(viewX) + viewWidth) / TILE_WIDTH) + 1;
         int endTileY = ((Math.abs(viewY) + viewHeight) / TILE_HEIGHT) + 1;
         //System.out.println("viewHeight=" + viewHeight + " viewY="+ viewY + " c=" + (viewY + viewHeight));

         if (endTileX > tilesWide) endTileX = tilesWide;
         if (endTileY > tilesHigh) endTileY = tilesHigh;

         byte tileType = 0;
         int xpos = 0;
         int ypos = 0;

// Loop through all the rows of the tile map that need to be drawn,
// then all the columns. This starts at startTileY and goes down till
// we get to the last viewable row at endTileY, then for each of these
// it goes across the map from startTileX to endTileX.
         for (int tileY = startY; tileY < endTileY; tileY++)
         {
            for (int tileX = startX; tileX < endTileX; tileX++)
            {
               if (tileY >= 0 && tileX >= 0)
               {
// Access the entry corresponding to this location. Since most
// tile maps contains empty space the code also does a quick
// check to see if it can just ignore this entry if the byte
// equals the default value 0 (NO_TILE).
                  tileType = tileMap[tileY][tileX];
                  if (tileType == NO_TILE)
                     continue; // quick abort if it's nothing

// Calculate the x and y position of this tile.
                  xpos = (tileX * TILE_WIDTH) - viewX;
                  ypos = (tileY * TILE_HEIGHT) - viewY;

// Check whether this tile position is in the view port.
                  if (xpos > 0 - TILE_WIDTH && xpos < viewWidth &&
                          ypos > 0 - TILE_HEIGHT && ypos < viewHeight)
                  {
                     if (tileType == GATEWAY_TILE)
                     {
// Draw the glowing gateway sprite.
                        gatewaySprite.draw(g, xpos, ypos);
                     }
                     else if (tileType >= START_REAL_TILE &&
                             tileType <= END_REAL_TILE)
                     {
// Based on the byte value this code draws an image
// from the ImageSet loaded in the constructor. To
// keep this simpler I抳e mapped the frames in the
// graphics file to the same byte values in the map.
// That way the code doesn抰 need to translate the
// values when drawing them [--] if the tile map byte
// is the number two the second frame from the loaded
// world images will be drawn (note that I take one
// away from the byte value to account for zero
// meaning no tile in the world).
                        tiles.draw(g, 0, tileType - 1, xpos, ypos);
                     }
                     else if (tileType >= START_ACTIVATOR_TILE &&
                             tileType <= END_ACTIVATOR_TILE)
                        activateTile(tileX, tileY);
                  }
               }
            }
         }

         // now draw all the actors that are in this sector
         Actor a = enemyShipPool.getFirstUsed();
         while (a != null)
         {
            //System.out.println("x=" + a.getX() + " y=" + a.getY() +
            //		  " x2=" + (viewX - TILE_WIDTH) + " y2=" + (viewY - TILE_HEIGHT) +
            //		  " w=" + (tw * TILE_WIDTH) +  " h=" + (th * TILE_HEIGHT) +
            //			" isInRect = " + Tools.isPointInRect(a.getX(), a.getY(), viewX - TILE_WIDTH,
            //															 viewY - TILE_HEIGHT, tw * TILE_WIDTH, th * TILE_HEIGHT)
            //);

            if (Tools.isPointInRect(a.getX(), a.getY(), viewX - TILE_WIDTH,
                                    viewY - TILE_HEIGHT, endTileX * TILE_WIDTH, endTileY * TILE_HEIGHT))
               a.render(g, viewX, viewY);

            a = a.getNextLinked();
         }

         // draw the player's ship
         playerShip.render(g, viewX, viewY);

         // render all the active bullets
         a = bulletPool.getFirstUsed();
         while (a != null)
         {
            if (Tools.isPointInRect(a.getX(), a.getY(), viewX - TILE_WIDTH,
                                    viewY - TILE_HEIGHT, endTileX * TILE_WIDTH, endTileY * TILE_HEIGHT))
               a.render(g, viewX, viewY);
            a = a.getNextLinked();
         }


      }
      catch (Exception e)
      {
         System.out.println("App exception: " + e);
         e.printStackTrace();
      }
   }

   private final void activateTile(int tileX, int tileY)
   {
      byte tileType = tileMap[tileY][tileX];
      int xpos = (tileX * TILE_WIDTH);
      int ypos = (tileY * TILE_HEIGHT);

      switch (tileType)
      {
         case DRONE_ACTIVATOR_TILE:
            getEnemyShipFromPool().init(Ship.ENEMY_DRONE, xpos, ypos);
            break;

         case TURRET_ACTIVATOR_TILE:
            getEnemyShipFromPool().init(Ship.ENEMY_TURRET, xpos, ypos);
            break;

         case FIGHTER_ACTIVATOR_TILE:
            getEnemyShipFromPool().init(Ship.ENEMY_FIGHTER, xpos, ypos);
            break;
      }
      // clear the activator tile
      tileMap[tileY][tileX] = NO_TILE;
   }


   /**
    * Save level to RMS (overwrites any existing level record)
    */
   public boolean saveLevel()
   {
      RecordStore store = null;
      try
      {
         try
         {
            RecordStore.deleteRecordStore("Level");
         }
         catch (RecordStoreNotFoundException rse)
         {
         }

         store = RecordStore.openRecordStore("Level", true);

         ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
         DataOutputStream dataOutputStream = new DataOutputStream(byteOutputStream);

         dataOutputStream.writeInt(levelNum);
         dataOutputStream.writeInt(GameScreen.getGameScreen().getLives());
         dataOutputStream.writeInt(startX);
         dataOutputStream.writeInt(startY);
         dataOutputStream.writeInt(tilesWide);
         dataOutputStream.writeInt(tilesHigh);

         for (int ty = 0; ty < tilesHigh; ty++)
            for (int tx = 0; tx < tilesWide; tx++)
               dataOutputStream.writeByte(tileMap[ty][tx]);

         dataOutputStream.flush();

         // delete the old one and add the new record
         byte[] recordOut = byteOutputStream.toByteArray();
         try
         {
            store.setRecord(1, recordOut, 0, recordOut.length);
         }
         catch (InvalidRecordIDException ir)
         {
            store.addRecord(recordOut, 0, recordOut.length);
         }
         dataOutputStream.close();
         byteOutputStream.close();

         return true;
      }

      catch (IOException io)
      {
         System.out.println("IOException: " + io);
         return false;
      }
      catch (RecordStoreException rse)
      {
         System.out.println("RSException: " + rse);
         return false;
      }

      finally
      {
         try
         {
            if (store != null) store.closeRecordStore();
         }

         catch (RecordStoreNotOpenException e)
         {
         }

         catch (RecordStoreException e)
         {
         }
      }

   }

   /**
    * returns the level number that was last saved (without loading the level)
    */
   public static int getSavedLevel()
   {
      RecordStore store = null;
      try
      {
         store = RecordStore.openRecordStore("Level", false);

         ByteArrayInputStream byteInputStream = new ByteArrayInputStream(store.getRecord(1));
         DataInputStream dataInputStream = new DataInputStream(byteInputStream);
         int level = dataInputStream.readInt();
         dataInputStream.close();
         byteInputStream.close();
         return level;
      }

      catch (IOException io)
      {
         System.out.println("IOException: " + io);
         return 0;
      }
      catch (RecordStoreNotOpenException rse)
      {
         return 0;
      }
      catch (RecordStoreException rse)
      {
         System.out.println("RSException: " + rse);
         return 0;
      }

      finally
      {
         try
         {
            if (store != null) store.closeRecordStore();
         }

         catch (RecordStoreNotOpenException e)
         {
         }

         catch (RecordStoreException e)
         {
         }
      }
   }


   /**
    * Called publicly by the GameScreen if the user is reloading the game
    * (they click on Resume Level, and the game is not loaded)
    * @return the levelNum loaded
    */
   public int loadLevel()
   {
      // load up the tilemap from RMS for the current level
      RecordStore store = null;
      try
      {
         store = RecordStore.openRecordStore("Level", true);

         ByteArrayInputStream byteInputStream = new ByteArrayInputStream(store.getRecord(1));
         DataInputStream dataInputStream = new DataInputStream(byteInputStream);

         levelNum = dataInputStream.readInt();
         int lives = dataInputStream.readInt();
         startX = dataInputStream.readInt();
         startY = dataInputStream.readInt();
         tilesWide = dataInputStream.readInt();
         tilesHigh = dataInputStream.readInt();

         tileMap = new byte[tilesHigh][tilesWide];
         for (int ty = 0; ty < tilesHigh; ty++)
            for (int tx = 0; tx < tilesWide; tx++)
               tileMap[ty][tx] = dataInputStream.readByte();

         playerShip.setStartingPos(startX * TILE_WIDTH, startY * TILE_HEIGHT);
         GameScreen.getGameScreen().setLives(lives);

         // now restart the world for this level
         restart();

         dataInputStream.close();
         byteInputStream.close();

         return levelNum;
      }

      catch (IOException io)
      {
         System.out.println("IOException: " + io);
         return 0;
      }
      catch (RecordStoreException rse)
      {
         System.out.println("RSException: " + rse);
         return 0;
      }

      finally
      {
         try
         {
            if (store != null) store.closeRecordStore();
         }

         catch (RecordStoreNotOpenException e)
         {
         }

         catch (RecordStoreException e)
         {
         }
      }
   }

   public void removeSavedGame()
   {
      try
      {
         RecordStore.deleteRecordStore("Level");
      }
      catch (RecordStoreNotFoundException rse)
      {
      }
      catch (RecordStoreException e)
      {
      }
   }


}














?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩在线| 精品一区二区三区日韩| 美女www一区二区| eeuss影院一区二区三区| 欧美精品在线观看播放| 1024成人网| 91麻豆免费看| 国产女人aaa级久久久级| 日本亚洲视频在线| 91成人免费电影| 国产精品网站在线| 国产精品羞羞答答xxdd| 日韩欧美久久久| 亚洲va欧美va国产va天堂影院| 成人综合婷婷国产精品久久| 日韩精品中文字幕在线不卡尤物 | 日本伦理一区二区| 中文字幕成人av| 国产在线视频一区二区| 欧美精品少妇一区二区三区 | 久久精品水蜜桃av综合天堂| 人禽交欧美网站| 欧美三级日本三级少妇99| 国产精品美女久久久久久 | 久久久美女艺术照精彩视频福利播放| 亚洲妇熟xx妇色黄| 一本大道久久精品懂色aⅴ| 国产日韩精品一区| 国产乱码精品一品二品| 久久久午夜精品理论片中文字幕| 久久99久久久欧美国产| 精品久久久三级丝袜| 麻豆精品一区二区| 久久九九99视频| 国产成人亚洲综合a∨婷婷| 国产亚洲一区二区三区四区| 国产成人免费9x9x人网站视频| 国产亚洲精品bt天堂精选| 国产在线精品一区二区| 国产精品网友自拍| 91麻豆成人久久精品二区三区| 亚洲四区在线观看| 色婷婷一区二区| 午夜免费久久看| 日韩美一区二区三区| 久草中文综合在线| 中文av一区二区| 91麻豆福利精品推荐| 亚洲国产成人av| 精品国产亚洲在线| 大美女一区二区三区| 亚洲精品老司机| 555www色欧美视频| 激情欧美一区二区| 成人免费在线视频观看| 欧美三级日本三级少妇99| 蜜乳av一区二区| 国产精品久久久久久久久免费桃花 | 日韩成人一区二区三区在线观看| 欧美精品一区二区三区视频| 99久久综合精品| 视频一区二区三区在线| 亚洲人成伊人成综合网小说| 在线成人小视频| 国产高清在线精品| 亚洲靠逼com| 日韩精品一区二区三区四区视频| 豆国产96在线|亚洲| 五月天久久比比资源色| 国产欧美精品日韩区二区麻豆天美| 99精品黄色片免费大全| 免费高清成人在线| 亚洲欧洲制服丝袜| 久久蜜桃av一区精品变态类天堂 | 欧美午夜在线观看| 韩国毛片一区二区三区| 亚洲免费在线视频一区 二区| 欧美精品18+| 色综合久久久久综合| 激情久久五月天| 亚洲福利视频导航| 亚洲日本欧美天堂| 久久综合狠狠综合久久综合88 | 国产一区不卡视频| 亚洲成人你懂的| 1区2区3区国产精品| 精品黑人一区二区三区久久| 日本福利一区二区| 99久久国产综合精品色伊| 韩国av一区二区三区四区| 亚洲综合在线第一页| 国产精品久久久爽爽爽麻豆色哟哟 | 亚洲6080在线| 亚洲欧美激情插| 中文字幕第一区第二区| 精品国产一区二区三区忘忧草| 欧美视频一区二区三区| 99久久综合99久久综合网站| 国产成人高清视频| 久久99精品国产.久久久久久| 亚洲国产综合人成综合网站| 国产精品天美传媒| 国产日韩综合av| 久久精品无码一区二区三区| 精品美女在线播放| 欧美一区二区三区不卡| 欧亚洲嫩模精品一区三区| 97成人超碰视| 99久久夜色精品国产网站| 成人午夜电影小说| 国产黑丝在线一区二区三区| 国内成人精品2018免费看| 久久精品国产99| 国产精品综合一区二区| 国产毛片一区二区| 国产精品99精品久久免费| 国产成人免费xxxxxxxx| 丁香六月综合激情| aaa欧美日韩| 色噜噜狠狠色综合中国| 日本高清不卡在线观看| 欧美日韩激情在线| 欧美一级高清大全免费观看| 日韩欧美国产综合一区| xfplay精品久久| 国产日韩精品一区| 亚洲色图清纯唯美| 亚洲成av人片在线观看无码| 婷婷综合另类小说色区| 久久97超碰国产精品超碰| 粉嫩绯色av一区二区在线观看| 成人小视频免费在线观看| 成人黄色电影在线 | 蜜臀久久99精品久久久画质超高清| 日韩精品1区2区3区| 久久精品国产亚洲aⅴ| 国产一区二区三区久久久| 成人app下载| 欧美性xxxxxx少妇| 欧美一三区三区四区免费在线看| 精品国产亚洲在线| 国产精品三级av| 亚洲成av人在线观看| 韩国精品久久久| 91免费版在线| 日韩一区二区三区视频在线观看 | 亚洲婷婷综合久久一本伊一区| 亚洲午夜私人影院| 久久99精品久久久| 99re视频这里只有精品| 欧美一三区三区四区免费在线看| 久久众筹精品私拍模特| 亚洲色图欧洲色图| 精彩视频一区二区| 91久久精品一区二区二区| 在线成人高清不卡| 欧美国产乱子伦| 免费人成精品欧美精品| www.亚洲在线| 精品美女在线播放| 一区二区三区在线观看动漫| 国产麻豆成人精品| 3atv一区二区三区| 亚洲欧洲精品天堂一级| 极品美女销魂一区二区三区| 91黄色激情网站| 久久久国产综合精品女国产盗摄| 午夜欧美在线一二页| jizz一区二区| 久久久99久久精品欧美| 午夜日韩在线观看| 91老师片黄在线观看| 久久先锋影音av鲁色资源| 日韩国产在线观看一区| 99国产精品99久久久久久| 日韩欧美中文一区二区| 亚洲国产综合91精品麻豆| av电影在线观看不卡| 国产亚洲成aⅴ人片在线观看| 日本vs亚洲vs韩国一区三区| 欧洲一区在线电影| 亚洲图片你懂的| 成年人国产精品| 国产精品国产自产拍高清av | 欧美无砖专区一中文字| 亚洲日本成人在线观看| 成人综合日日夜夜| 久久青草国产手机看片福利盒子 | 日韩高清中文字幕一区| 欧美色手机在线观看| 亚洲精品精品亚洲| av男人天堂一区| 亚洲少妇最新在线视频| 成人黄色a**站在线观看| 欧美国产精品专区| 成人视屏免费看| 国产精品女人毛片| 懂色av一区二区三区免费观看| 国产欧美日韩激情| 成人免费观看视频|