亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩欧美在线不卡| 九九国产精品视频| 日本一区二区免费在线观看视频| 欧美精品久久99| 在线视频一区二区免费| 色老头久久综合| 91视频www| 91亚洲大成网污www| 不卡的av在线| 91日韩精品一区| 成人高清视频在线观看| 成人av资源网站| 99久久久无码国产精品| 97精品电影院| 色妞www精品视频| 91丝袜国产在线播放| 一本大道av一区二区在线播放| 成人国产精品免费观看视频| 不卡av电影在线播放| 成人教育av在线| 成人动漫精品一区二区| caoporm超碰国产精品| 色综合天天综合| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 洋洋成人永久网站入口| 亚洲国产一区二区在线播放| 午夜精品一区二区三区电影天堂| 日韩成人dvd| 久久精品国产精品亚洲红杏| 国内成+人亚洲+欧美+综合在线| 精品亚洲成a人| 国产91精品精华液一区二区三区| 99久久精品免费精品国产| 91激情在线视频| 欧美日本一区二区三区四区| 欧美电影免费观看完整版| 久久久三级国产网站| 国产精品久久久久影院亚瑟| 一区二区三区免费| 免费在线观看日韩欧美| 国产成人免费9x9x人网站视频| av爱爱亚洲一区| 欧美美女网站色| 337p日本欧洲亚洲大胆精品| 国产精品二区一区二区aⅴ污介绍| 一区二区三区高清| 精品一区二区三区影院在线午夜| 国产成a人亚洲| 欧美午夜寂寞影院| 亚洲精品一区二区三区四区高清| 国产精品高潮久久久久无| 午夜精品成人在线| 国产成人精品影视| 欧美嫩在线观看| 国产女人18毛片水真多成人如厕 | 成人毛片在线观看| 欧美性猛片aaaaaaa做受| 精品少妇一区二区三区在线视频| 国产精品福利一区二区| 蜜桃av一区二区| 99精品久久99久久久久| 日韩欧美国产一区二区在线播放 | 最新欧美精品一区二区三区| 日日欢夜夜爽一区| 丁香婷婷综合色啪| 日韩一级成人av| 亚洲色图制服丝袜| 国产精品亚洲一区二区三区妖精 | 国产精品久久二区二区| 免费亚洲电影在线| 在线一区二区观看| 国产欧美日韩亚州综合 | 国产欧美一区二区三区沐欲 | 成人毛片视频在线观看| 欧美大片一区二区| 亚洲一区二区三区中文字幕| 国产福利一区二区三区在线视频| 欧美日韩电影一区| 亚洲色欲色欲www在线观看| 国产精品一区二区不卡| 在线播放国产精品二区一二区四区| 国产精品伦一区二区三级视频| 蜜桃av一区二区在线观看| 欧美亚洲国产一区二区三区va| 国产精品国产三级国产| 国产成人精品1024| 日韩欧美中文字幕公布| 亚洲h在线观看| 在线视频你懂得一区| 国产精品第一页第二页第三页| 激情文学综合网| 欧美日本不卡视频| 亚洲影视资源网| 色综合久久久久| 中文字幕一区视频| 高清成人在线观看| 久久九九影视网| 国产综合成人久久大片91| 日韩一级二级三级精品视频| 五月综合激情日本mⅴ| 欧美日韩中字一区| 亚洲福利视频一区| 欧美视频一二三区| 一区二区三区高清不卡| 日本韩国欧美一区二区三区| ...中文天堂在线一区| 不卡欧美aaaaa| 国产精品国产三级国产专播品爱网| 国产传媒日韩欧美成人| 国产日韩欧美亚洲| 国产精品18久久久久久久网站| 精品国产网站在线观看| 国内精品嫩模私拍在线| 久久综合狠狠综合久久综合88| 激情综合一区二区三区| 久久这里只有精品6| 国产成人免费在线视频| 国产精品久久久久久福利一牛影视| 不卡视频一二三四| 亚洲美女屁股眼交3| 欧美在线不卡视频| 丝袜美腿亚洲一区二区图片| 91精品久久久久久久99蜜桃| 青青草视频一区| 久久久噜噜噜久久中文字幕色伊伊 | 中文字幕免费不卡在线| 波多野结衣的一区二区三区| 亚洲色图欧美在线| 日本黄色一区二区| 日本在线播放一区二区三区| 日韩欧美亚洲一区二区| 国产一区二区免费视频| 国产精品少妇自拍| 一本在线高清不卡dvd| 天天免费综合色| 久久婷婷国产综合精品青草| 成人一级片在线观看| 亚洲欧美日韩久久| 欧美欧美欧美欧美| 国产麻豆成人精品| 中文字幕在线观看一区二区| 在线观看91视频| 毛片不卡一区二区| 国产精品人妖ts系列视频| 日本韩国精品一区二区在线观看| 日本aⅴ精品一区二区三区| 欧美精品一区二区三区高清aⅴ| 高清在线观看日韩| 亚洲va韩国va欧美va精品| 欧美精品一区二区在线观看| 91视频免费观看| 青青青爽久久午夜综合久久午夜| 国产天堂亚洲国产碰碰| 色激情天天射综合网| 久久97超碰色| 亚洲精品综合在线| 日韩精品专区在线影院观看| 91在线免费视频观看| 日本在线不卡一区| 亚洲欧美一区二区久久| 欧美一区二区三区电影| 不卡一区二区中文字幕| 青青草伊人久久| 亚洲免费在线播放| 久久综合久久鬼色中文字| 欧洲色大大久久| 国产九色精品成人porny| 午夜婷婷国产麻豆精品| 国产精品国产三级国产普通话99| 91精品国产综合久久福利| 91论坛在线播放| 国精产品一区一区三区mba桃花| 亚洲一区在线视频观看| 国产精品视频一二三| 欧美va日韩va| 欧美久久高跟鞋激| 99国产精品国产精品久久| 久草精品在线观看| 亚洲aaa精品| 亚洲少妇30p| 国产欧美精品一区二区色综合朱莉| 欧美三电影在线| 99re在线精品| 国产又黄又大久久| 五月婷婷色综合| 亚洲激情自拍视频| 国产精品麻豆视频| 久久久影院官网| 日韩一区二区三区免费看| 欧洲色大大久久| 99精品欧美一区二区三区综合在线| 老司机一区二区| 五月天视频一区| 一区二区三区产品免费精品久久75| 国产日韩成人精品| 2023国产精华国产精品| 欧美一区二区三区免费视频| 欧美视频一区二区在线观看| 91久久精品一区二区| 91在线观看污|