Advertisement
thomasfelix

PBO 6

Nov 23rd, 2020 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. /**
  2.  * Class ini menampilkan lokasi game yang menghubungkan satu room dengan room
  3.  * lain dengan pintu keluar.
  4.  * Ada pintu keluar north, east, south, dan west.
  5.  * @author Thomas Felix
  6.  * @version 23 November 2020
  7.  */
  8.  
  9. public class Room
  10. {
  11.     public String description;
  12.     public Room northExit;
  13.     public Room southExit;
  14.     public Room eastExit;
  15.     public Room westExit;
  16.    
  17.     public Room(String description)
  18.     {
  19.         this.description = description;
  20.     }
  21.    
  22.     public void setExits(Room north, Room east, Room south, Room west)
  23.     {
  24.         if (north != null)
  25.         {
  26.             northExit = north;
  27.         }
  28.        
  29.         if (east != null)
  30.         {
  31.             eastExit = east;
  32.         }
  33.        
  34.         if (south != null)
  35.         {
  36.             southExit = south;
  37.         }
  38.        
  39.         if (west != null)
  40.         {
  41.             westExit = west;
  42.         }
  43.     }
  44.    
  45.     public String getDescription()
  46.     {
  47.         return description;
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement