Example #1
0
        public void GenerateRooms(int numRooms)
        {
            int currNumRooms = 1;

            rooms[ROOMSW / 2, ROOMSH / 2] = new Room(tilesets[0], ROOMSW / 2, ROOMSH / 2);

            while (currNumRooms < numRooms)
            {
                int randX = rand.Next(ROOMSW);
                int randY = rand.Next(ROOMSH);
                if (Neightboring(randX, randY) == 1
                    && rooms[randX, randY] == null)
                {
                    int layout = rand.Next(LAYOUTS);
                    rooms[randX, randY] = new Room(tilesets[layout], randX, randY);
                    foreach (Enemy e in enemyConfigs[layout])
                    {
                        Actor a = (Actor)e;
                        a.Translate((randX * 800) + 0 * Tile.WIDTH, (randY * 480) + 0 * Tile.HEIGHT);
                        a.CurrentRoom = rooms[randX, randY];
                        manager.ActorManager.Add(a);
                    }
                    currNumRooms++;
                }
            }

            currRoom = rooms[ROOMSW / 2, ROOMSH / 2];

            GenerateDoors();
            GenerateSpecials();
            GenerateSpecials();
        }
Example #2
0
 public void MoveRoom(int x, int y)
 {
     currRoom = rooms[x,y];
 }
 public void MoveRoom(Room room)
 {
     map.CurrentRoom = room;
 }