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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? levelgenerator.java

?? 大量j2me源代碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
               {
                  if (dir == UP_DIR)
                     corridorY = lastRoomY - corridorHeight + 1;
                  if (dir == DOWN_DIR)
                     corridorY = lastRoomY + lastRoomH - 1;

                  corridorX = Tools.getRand(Math.max(lastRoomX, newRoomX),
                                            Math.min(lastRoomX + lastRoomW -
                                                     corridorWidth,
                                                     newRoomX + newRoomW -
                                                     corridorWidth));
               }

               // Draw the corridor on the tilemap.
               addRoom(level, corridorX, corridorY, corridorWidth,
                       corridorHeight);

               // Set the last room index to be the room we added (step back by
               // an extra one to skip the corridor just added to connect the
               // new room to the last one).
               lastRoomIndex = roomCount - 2;
            }
         }
      }

      // End point is the second last room we added (last one
      // was the corridor to it)
      setEndPoint(roomX[roomCount - 2] + roomW[roomCount - 2] / 2,
                  roomY[roomCount - 2] + roomH[roomCount - 2] / 2);

      //#ifdef debug
      dump();
      //#endif
      return tileMap;
   }

   /**
    * Sets the exit point in the tile map (the gateway tile).
    * @param tileX The x position of the end point.
    * @param tileY The y position of the end point.
    */
   private final void setEndPoint(int tileX, int tileY)
   {
      tileMap[tileY][tileX] = World.GATEWAY_TILE;
   }

   /**
    * @param b An array of booleans to test.
    * @return True if all the booleans in the array are true.
    */
   private static final boolean areAllTrue(boolean[] b)
   {
      for (int i = 0; i < b.length; i++)
         if (b[i] == false) return false;
      return true;
   }

   /**
    * Based on an array of boolean's this returns a random choice from a limited
    * list of ones that are currently false. The level generator uses this to
    * randomly choose a direction, but only from ones that have not previously
    * been tried (set to true in the array).
    */
   private static final int getRandDir(boolean[] dirs)
   {
      // we only do a random test on the number of available dirs, so lets
      // find out how many there are first
      int numDirs = 0;
      for (int i = 0; i < 4; i++)
         if (!dirs[i]) numDirs++;

      if (numDirs == 0) return 0;

      // now pick one at random
      int n = 0;
      if (numDirs > 1)
         n = Tools.getRand(0, numDirs - 1);

      // and return the dir corresponding to the nth result by figuring
      // the array index of the nth true value
      int c = -1;
      int i = 0;
      while (i < dirs.length)
      {
         if (!dirs[i++]) c++;
         if (c == n) return i - 1;
      }

      return 0;
   }

   /**
    * Checks to see if the supplied rectangle is within 3 tiles of any other
    * room (including corridors).
    * @param tileX The x position of the room to be checked.
    * @param tileY The y position of the room to be checked.
    * @param tilesWide The width of the room to be checked.
    * @param tilesHigh The height of the room to be checked.
    * @return True if the rectangle (room) is within 3 tiles of another.
    */
   private final boolean isRectNearRoom(int tileX, int tileY, int tilesWide,
                                        int tilesHigh)
   {
      for (int i = 0; i < roomCount; i++)
      {
         if (Tools.isIntersectingRect(tileX, tileY, tilesWide, tilesHigh,
                                      roomX[i] - 3, roomY[i] - 3,
                                      roomW[i] + 3, roomH[i] + 3))
         {
            return true;
         }
      }
      return false;
   }

   /**
    * Adds a room to the level by setting all the bytes in the tilemap to be
    * walls. Note that existing wall tiles will be inverted by this process
    * (except for corners) in order to "carve out" doorways where the walls
    * between rooms and corridors overlap.
    * @param level The level number is a relative density level used to fill
    * the room with objects.
    * @param tileX The x position of the new room.
    * @param tileY The y position of the new room.
    * @param tileWidth The width of the new room.
    * @param tileHeight The height of the new room.
    */
   private void addRoom(int level, int tileX, int tileY, int tileWidth,
                        int tileHeight)
   {
      //System.out.println("adding room: " + roomCount + " max=" + roomW.length +
      // " xy=" + x + ", " + y + " tileMapsize=" + tileMap[0].length + "," +
      // tileMap.length);

      // If it's a corridor we dont just add tiles, we invert in order
      // to cut doorways out of the rooms
      addWallsToMap(tileX, tileY, tileWidth, tileHeight);
      roomW[roomCount] = tileWidth;
      roomH[roomCount] = tileHeight;
      roomX[roomCount] = tileX;
      roomY[roomCount] = tileY;
      roomCount++;

      // Add enemy to this room (we base the number on the level they're on)
      int maxEnemy = level + 1;
      if (maxEnemy > 10) maxEnemy = 10;
      int numEnemy = Tools.getRand(0, maxEnemy);

      int numAdded = 0;
      int tries = 0;
      while (numAdded < numEnemy && tries++ < maxEnemy * 2)
      {
         // Pick a random tile and try to add an activator there (may be filled
         // by another one)
         int tx = Tools.getRand(tileX + 1, tileX + tileWidth - 2);
         int ty = Tools.getRand(tileY + 1, tileY + tileHeight - 2);

         if (tileMap[ty][tx] == World.NO_TILE &&
                 (tx != playerStartX && ty != playerStartY))
         {
            numAdded++;

            // Now pick a random enemy type (again factored on the level).
            if (level < 2)
               tileMap[ty][tx] = World.DRONE_ACTIVATOR_TILE;
            else if (level < 3)
               tileMap[ty][tx] =
                       (byte) Tools.getRand(World.DRONE_ACTIVATOR_TILE,
                                            World.TURRET_ACTIVATOR_TILE);
            else
               tileMap[ty][tx] =
                       (byte) Tools.getRand(World.START_ACTIVATOR_TILE + 1,
                                            World.END_ACTIVATOR_TILE - 1);
         }
      }
   }

   /**
    * Toggles tiles in the tilemap to either a wall or an empty space (based on
    * what is there already) in an outline rectangle using the supplied bounding
    * coordinates. Note that corners are NOT inverted, they are always set as
    * walls.
    * @param roomTileX The starting x position of the room to create.
    * @param roomTileY The starting y position of the room to create.
    * @param roomTilesWide The width of the room to create.
    * @param roomTilesHigh The height of the room to create.
    */
   private void addWallsToMap(int roomTileX, int roomTileY,
                              int roomTilesWide, int roomTilesHigh)
   {
      // Add the top and bottom line.
      for (int tileX = roomTileX; tileX < roomTileX + roomTilesWide; tileX++)
      {
         // Invert the tiles along the top.
         invertTile(tileX, roomTileY);
         // Invert the tiles along the bottom.
         invertTile(tileX, roomTileY + roomTilesHigh - 1);
      }

      // Left and right side lines.
      for (int tileY = roomTileY + 1; tileY < roomTileY + roomTilesHigh - 1;
           tileY++)
      {
         // Invert the tiles down the left side.
         invertTile(roomTileX, tileY);
         // Invert the tiles down the right side.
         invertTile(roomTileX + roomTilesWide - 1, tileY);
      }

      // Mark corners as walls (not inverted).
      tileMap[roomTileY][roomTileX] = World.WALL_TILE;
      tileMap[roomTileY][roomTileX + roomTilesWide - 1] = World.WALL_TILE;
      tileMap[roomTileY + roomTilesHigh - 1][roomTileX] = World.WALL_TILE;
      tileMap[roomTileY + roomTilesHigh - 1][roomTileX + roomTilesWide - 1] =
              World.WALL_TILE;
   }

   /**
    * Inverts an existing map tile between either empty or a wall tile.
    * @param tileX The x position of the tile to invert.
    * @param tileY The y position of the tile to invert.
    */
   private void invertTile(int tileX, int tileY)
   {
      // Turn an empty tile into a wall or vice versa.
      if (tileMap[tileY][tileX] == World.WALL_TILE)
         tileMap[tileY][tileX] = World.NO_TILE;
      else
         tileMap[tileY][tileX] = World.WALL_TILE;
   }

   private void dump()
   {
      System.out.println("\t          1         2         3         4         5");
      System.out.println("\t012345678901234567890123456789012345678901234567890");

      for (int ty = 0; ty < height; ty++)
      {
         System.out.print(ty + "\t");

         for (int tx = 0; tx < width; tx++)
         {
            if (tileMap[ty][tx] == World.WALL_TILE)
               System.out.print("#");
            else if (tileMap[ty][tx] == World.GATEWAY_TILE)
               System.out.print("$");
            else if (tileMap[ty][tx] == World.DRONE_ACTIVATOR_TILE)
               System.out.print("D");
            else if (tileMap[ty][tx] == World.TURRET_ACTIVATOR_TILE)
               System.out.print("T");
            else if (tileMap[ty][tx] == World.FIGHTER_ACTIVATOR_TILE)
               System.out.print("F");
            else if (playerStartX == tx && playerStartY == ty)
               System.out.print("X");
            else
               System.out.print(" ");
         }
         System.out.println();
      }

   }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品在线视频一区| 成人精品电影在线观看| 国产精品久久久久久久久久久免费看 | 亚洲成人av在线电影| 亚洲女女做受ⅹxx高潮| 中文字幕在线不卡| 亚洲女同ⅹxx女同tv| 一区二区三区四区中文字幕| 亚洲欧美电影一区二区| 亚洲欧美日韩国产手机在线| 最新国产成人在线观看| 亚洲欧洲三级电影| 一区二区三区小说| 日韩精品电影在线观看| 蜜臀久久99精品久久久画质超高清| 日本美女一区二区三区| 精品一区二区三区日韩| 国产二区国产一区在线观看| www.一区二区| 在线视频你懂得一区二区三区| 欧美网站一区二区| 日韩精品专区在线影院重磅| 久久精品夜色噜噜亚洲aⅴ| 国产欧美精品一区二区色综合| 国产精品沙发午睡系列990531| 国产精品久久精品日日| 亚洲国产精品嫩草影院| 男女激情视频一区| 国产成人精品午夜视频免费| 91丝袜美女网| 欧美久久久影院| 久久免费精品国产久精品久久久久| 国产精品不卡在线观看| 亚洲影视资源网| 韩国v欧美v日本v亚洲v| www.亚洲激情.com| 欧美日韩国产精品自在自线| 欧美videos中文字幕| 国产精品私人自拍| 亚洲成人在线网站| 国产激情视频一区二区在线观看 | 国产欧美一区二区精品婷婷| 中文字幕亚洲在| 日韩av中文字幕一区二区三区| 国产精品一卡二| 欧美日韩中文字幕一区| 久久天天做天天爱综合色| 日韩美女视频19| 免费观看在线综合| 91首页免费视频| 精品国产凹凸成av人网站| 亚洲精品免费看| 国产一二三精品| 欧美久久久久久蜜桃| 欧美国产精品中文字幕| 首页国产欧美久久| 成+人+亚洲+综合天堂| 91精品国产全国免费观看| 国产日韩欧美精品一区| 午夜电影网亚洲视频| 成人在线视频一区| 日韩一区二区免费电影| 一区二区三区自拍| 国产精品亚洲视频| 欧美男女性生活在线直播观看| 中文字幕乱码日本亚洲一区二区 | 成人国产电影网| 欧美美女直播网站| 中文字幕在线不卡一区| 久久精品国产免费| 欧美日韩成人综合在线一区二区| 国产精品不卡视频| 国产成人精品免费在线| 欧美www视频| 午夜精品久久久久久久蜜桃app| 91在线小视频| 国产精品免费丝袜| 国产一区二区精品久久99| 欧美一区二区美女| 视频在线观看国产精品| 色av一区二区| 亚洲精品成人精品456| 成人三级伦理片| 国产日韩欧美综合一区| 国产一区视频导航| 精品久久99ma| 蜜桃久久av一区| 欧美一区二区三区在线看| 亚洲一区二区三区不卡国产欧美 | 精品国产91亚洲一区二区三区婷婷 | 亚洲国产精品久久人人爱蜜臀| 99免费精品在线| 中文字幕亚洲在| 91色.com| 樱桃国产成人精品视频| 99精品桃花视频在线观看| 欧美韩国日本不卡| 成人黄色在线视频| 亚洲国产精品二十页| 国产成+人+日韩+欧美+亚洲| 久久精品一区二区三区av| 国产黑丝在线一区二区三区| 久久综合五月天婷婷伊人| 久久精品噜噜噜成人av农村| 日韩午夜激情视频| 韩国一区二区视频| 久久久久一区二区三区四区| 国产综合久久久久久鬼色| 久久婷婷国产综合国色天香| 国产激情视频一区二区三区欧美| 国产日韩视频一区二区三区| 成人av网址在线观看| ...中文天堂在线一区| 日本高清免费不卡视频| 亚洲国产综合视频在线观看| 欧美老肥妇做.爰bbww| 青青国产91久久久久久| 精品美女在线播放| 国产精品538一区二区在线| 中文字幕第一区二区| 色综合激情五月| 亚洲丰满少妇videoshd| 欧美电影免费观看高清完整版在线 | 91精品国产乱码久久蜜臀| 日韩1区2区日韩1区2区| 精品不卡在线视频| 波多野结衣中文字幕一区二区三区| 中文字幕在线不卡一区二区三区| 色婷婷一区二区三区四区| 亚洲一区视频在线| 91精品国产综合久久久蜜臀粉嫩 | 欧美日韩精品一区二区| 免费看日韩a级影片| 久久久综合九色合综国产精品| 丁香六月久久综合狠狠色| 亚洲日本va在线观看| 7777精品久久久大香线蕉| 韩国女主播一区| 亚洲乱码中文字幕综合| 欧美精品v国产精品v日韩精品 | 91在线视频18| 爽好久久久欧美精品| 欧美国产视频在线| 欧美日韩精品免费观看视频| 国产毛片精品视频| 夜夜嗨av一区二区三区四季av| 精品免费日韩av| 在线看日本不卡| 国产乱码精品一区二区三| 亚洲一区国产视频| 久久精品人人做人人综合| 欧美三级电影网| 不卡av在线免费观看| 日韩中文字幕麻豆| 国产精品久久久久一区| 3751色影院一区二区三区| 粉嫩av一区二区三区粉嫩| 日韩一区精品字幕| 亚洲日本在线a| 国产婷婷色一区二区三区四区 | 国产亚洲欧美日韩俺去了| 日本高清视频一区二区| 韩国精品免费视频| 天天色天天操综合| 亚洲同性同志一二三专区| 欧美大片国产精品| 欧美亚洲综合在线| 不卡免费追剧大全电视剧网站| 毛片基地黄久久久久久天堂| 一区二区三区中文字幕在线观看| 久久久久久久久久电影| 欧美日韩一区精品| 91小视频在线观看| 国产乱子伦视频一区二区三区| 香蕉成人啪国产精品视频综合网| 国产精品午夜在线观看| 精品理论电影在线观看| 欧美日韩国产美| 色婷婷综合五月| jiyouzz国产精品久久| 国产精品一区二区不卡| 另类专区欧美蜜桃臀第一页| 午夜视频在线观看一区二区三区| 国产精品福利一区| 中文字幕欧美国产| 国产色一区二区| 日韩欧美国产小视频| 91精品在线免费观看| 欧美三级视频在线| 色就色 综合激情| 91一区二区三区在线播放| 丁香婷婷综合激情五月色| 国产成人亚洲综合a∨婷婷| 久久不见久久见免费视频7 | 在线视频国内自拍亚洲视频| 不卡区在线中文字幕| 波多野结衣视频一区| 成人毛片视频在线观看| 成人高清视频在线观看| 菠萝蜜视频在线观看一区|