Beispiel #1
0
 /**
  *  -----===-----
  * |    back     |
  * |             |
  * *    room2    *
  * |             |  The room layout as described below
  * |    front    |  in code (hopefully)
  *  -----===-----
  * |    back     |
  * |             |
  * *    room     *
  * |             |
  * |    front    |
  *  -----===-----
  */
 protected void linkRooms(Room room, Room room2, RoomPlaces roomPlace)
 {
     switch (roomPlace) {
     case RoomPlaces.front:
         room.back = room2;
         room2.front = room;
         break;
     case RoomPlaces.back:
         room2.back = room;
         room.front = room2;
         break;
     case RoomPlaces.left:
         room.left = room2;
         room2.right = room;
         break;
     case RoomPlaces.right:
         room.right = room2;
         room2.left = room;
         break;
     }
 }
Beispiel #2
0
        /**
         * Sets up the map
         * TODO: Load externally made maps using the Room concept
         */
        private void initialiseRooms()
        {
            Room entrance = new Room ("entrance");
            entrance.openArea = true;

            Room ehallway = new Room ("enemy hallway");
            ehallway.items.Add(new SmallHealth());

            Room kitchen = new Room ("kitchen");
            kitchen.items.Add(new Pistol());

            Room ehallway2 = new Room ("enemy hallway");

            ehallway2.battle.fleeSteps = 2;
            ehallway2.battle.enemies.Add(new Vampire());
            Room ehallway3 = new Room ("enemy hallway");

            Room rhallway1 = new Room("recovery hallway");
            Room rhallway2 = new Room("recovery hallway");
            Room rhallway3 = new Room("recovery hallway");
            Room rhallway4 = new Room("recovery hallway");

            Room nhallway = new Room("narrow hallway");
            Room nhallway2 = new Room("narrow hallway");

            Room dhallway = new Room("dungeon hallway");
            Room dhallway2 = new Room("dungeon hallway");
            Room dhallway3 = new Room("dungeon hallway");
            Room dhallway4 = new Room("dungeon hallway");

            Room lhallway = new Room("loot hallway");
            Room lhallway2 = new Room("loot hallway");

            Room lootroom = new Room("loot room");

            linkRooms (entrance, ehallway, RoomPlaces.front);
            linkRooms (ehallway, ehallway2, RoomPlaces.right);
            linkRooms (ehallway2, ehallway3, RoomPlaces.right);
            linkRooms (ehallway, kitchen, RoomPlaces.left);
            linkRooms (ehallway3, rhallway1, RoomPlaces.front);
            linkRooms (rhallway1, rhallway2, RoomPlaces.front);
            linkRooms (rhallway2, rhallway3, RoomPlaces.front);
            linkRooms (rhallway3, rhallway4, RoomPlaces.front);
            linkRooms (rhallway4, nhallway, RoomPlaces.left);
            linkRooms (nhallway, nhallway2, RoomPlaces.left);
            linkRooms (nhallway2, dhallway, RoomPlaces.front);
            linkRooms (dhallway, dhallway2, RoomPlaces.front);
            linkRooms (dhallway2, dhallway3, RoomPlaces.front);
            linkRooms (dhallway3, dhallway4, RoomPlaces.front);
            linkRooms (dhallway4, lhallway, RoomPlaces.left);
            linkRooms (lhallway, lhallway2, RoomPlaces.left);
            linkRooms (lhallway2, lootroom, RoomPlaces.back);

            playerone = new Player (entrance);
            playerone.inventory.Add(new Fists());
        }
Beispiel #3
0
 public Player(Room startingroom)
 {
     currentRoom = startingroom;
     health = 30;
     money = 0;
 }