Dependencies:
               
        
     
    
        
             
            mbed
         
    
        
             
            MotionSensor
         
    
    
« Back to documentation index 
    
 
Room Class Reference 
 
 
Room  Class.  
More... 
#include <Room.h >
 
Public Member Functions 
  Room  (int no_of_enemies, int room_type) 
  Constructors.    
  ~Room  () 
  Destructors.    
void  set_doorway  (int index, bool doorway_value) 
  sets _doorway at index "index" with the value of "doorway_value"    
void  set_boss_doorway  (int before_boss_room) 
  sets the position of boss doorway on this room    
char *  get_current_map_2d  () 
  get the 2d map array that dictates where there are walls or empty space    
bool *  get_doorways  () 
  get the doorways of the room    
bool  get_doorway  (int index) 
  get the doorway status of the room at index "index"    
char  get_room_type  () 
  get the type of room    
int  get_boss_doorway  () 
  get the boss doorway status    
void  load  () 
  loads all the entities in the room    
void  unload  () 
  deletes all entities in the room    
void  update_doorways  () 
  close all doorways if the room is a boss room    
void  draw  (N5110  &lcd, int j) 
  draws the room including enemies    
void  draw_room  (N5110  &lcd) 
  draws the room    
void  draw_room_overlay  (N5110  &lcd) 
  draws the room_overlay    
bool  enemies_exist  () 
  checks if there is any valid enemies in the room    
 
Data Fields 
Entity  * enemies  [MAX_ENEMIES] 
  A pointer to an array of Entities where all the possible enemies in the room are stored.    
bool  valid_enemies  [MAX_ENEMIES] 
  A boolean array to dictate which enemies exist.    
Entity  * collectibles  [MAX_ENEMIES] 
  A pointer to an array of Entities where all the possible collectibles in the room are stored.    
bool  valid_collectibles  [MAX_ENEMIES] 
  A boolean array to dictate which collectibles exist.    
Entity  * walls  [2] 
  A pointer to an array of Entities where all the possible walls in the room are stored.    
bool  valid_walls  [2] 
  A boolean array to dictate which walls exist.    
int  enemies_type  [MAX_ENEMIES] 
  An array of enemy types for each enemy in the room.    
Detailed Description 
Room  Class. 
Author: Steven Mahasin Create a Room  which holds the enemies, collectibles and doorways   
Date: May 2019   
Definition at line 20  of file Room.h .
Constructor & Destructor Documentation 
 
      
        
          Room   
          ( 
          int  
           no_of_enemies ,  
         
        
           
           
          int  
           room_type   
         
        
           
          ) 
           
         
      
 
Constructors. 
create a room with a set number of enemies and a set room type 
Parameters: 
  
    no_of_enemies the number of enemies to be spawned in the room   
    room_type the type of room to be initialised with   
  
   
 
Definition at line 4  of file Room.cpp .
 
 
 
Destructors. 
Definition at line 80  of file Room.cpp .
 
 
Member Function Documentation 
 
      
        
          void draw  
          ( 
          N5110  &  
           lcd ,  
         
        
           
           
          int  
           j   
         
        
           
          ) 
           
         
      
 
draws the room including enemies 
Parameters: 
  
    lcd the screen in which the room is being drawn in   
    j the current y-position of entities that are being drawn   
  
   
 
Definition at line 190  of file Room.cpp .
 
 
 
      
        
          void draw_room  
          ( 
          N5110  &  
           lcd  ) 
           
         
      
 
draws the room 
Parameters: 
  
    lcd the screen in which the room is being drawn in   
  
   
 
Definition at line 229  of file Room.cpp .
 
 
 
      
        
          void draw_room_overlay  
          ( 
          N5110  &  
           lcd  ) 
           
         
      
 
draws the room_overlay 
Parameters: 
  
    lcd the screen in which the room_overlay is being drawn in   
  
   
 
Definition at line 245  of file Room.cpp .
 
 
 
checks if there is any valid enemies in the room 
Returns: true if there is any valid enemies in the room   
Definition at line 273  of file Room.cpp .
 
 
 
get the boss doorway status 
Returns: _before_boss_room   
Definition at line 116  of file Room.cpp .
 
 
 
      
        
          char * get_current_map_2d  
          ( 
           ) 
           
         
      
 
get the 2d map array that dictates where there are walls or empty space 
Returns: the char pointer array of the 2d level map   
Definition at line 97  of file Room.cpp .
 
 
 
      
        
          bool get_doorway  
          ( 
          int  
           index  ) 
           
         
      
 
get the doorway status of the room at index "index" 
Returns: _doorway[index]   
Definition at line 106  of file Room.cpp .
 
 
 
get the doorways of the room 
Returns: boolean pointer array of the _doorways member variable   
Definition at line 101  of file Room.cpp .
 
 
 
get the type of room 
Returns: _room_type   
Definition at line 111  of file Room.cpp .
 
 
 
loads all the entities in the room 
Definition at line 141  of file Room.cpp .
 
 
 
      
        
          void set_boss_doorway  
          ( 
          int  
           before_boss_room  ) 
           
         
      
 
sets the position of boss doorway on this room 
Parameters: 
  
    before_boss_room the side in which boss doorway exists (0-3 = sides, 4 = doesn't exist)   
  
   
 
Definition at line 91  of file Room.cpp .
 
 
 
      
        
          void set_doorway  
          ( 
          int  
           index ,  
         
        
           
           
          bool  
           doorway_value   
         
        
           
          ) 
           
         
      
 
sets _doorway at index "index" with the value of "doorway_value" 
Parameters: 
  
    index the index of the mutated doorway   
    doorway_value the value of the mutated doorway   
  
   
 
Definition at line 86  of file Room.cpp .
 
 
 
deletes all entities in the room 
Definition at line 166  of file Room.cpp .
 
 
 
close all doorways if the room is a boss room 
Definition at line 180  of file Room.cpp .
 
 
Field Documentation 
 
A pointer to an array of Entities where all the possible collectibles in the room are stored. 
Definition at line 204  of file Room.h .
 
 
 
A pointer to an array of Entities where all the possible enemies in the room are stored. 
Definition at line 196  of file Room.h .
 
 
 
An array of enemy types for each enemy in the room. 
Note: currently only snake and headless   
Definition at line 221  of file Room.h .
 
 
 
A boolean array to dictate which collectibles exist. 
Definition at line 208  of file Room.h .
 
 
 
A boolean array to dictate which enemies exist. 
Definition at line 200  of file Room.h .
 
 
 
A boolean array to dictate which walls exist. 
Definition at line 216  of file Room.h .
 
 
 
A pointer to an array of Entities where all the possible walls in the room are stored. 
Definition at line 212  of file Room.h .