embedded-software
reusable software modules for embedded systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Building Module

This module can be used in terminal-based games to add buildings and check collisions between them an any char_object_t. More...

Data Structures

struct  building_t
 Building info structure. More...
 

Typedefs

typedef struct building_t building_t
 
typedef enum check_collision check_collision
 Enum to store collision type for use with building_t. More...
 

Enumerations

enum  check_collision { NO_COLLISION = 0, COLLISION = 1, DOOR = 2 }
 Enum to store collision type for use with building_t. More...
 

Functions

void Game_DrawBuilding (building_t building)
 Function to draw buildings with doors. More...
 
enum check_collision Game_CollisionDown (building_t building, char_object_t player)
 Detects collision during downward movement. More...
 
enum check_collision Game_CollisionUp (building_t building, char_object_t player)
 Detects collision during upward movement. More...
 
enum check_collision Game_CollisionLeft (building_t building, char_object_t player)
 Detects collision during leftward movement. More...
 
enum check_collision Game_CollisionRight (building_t building, char_object_t player)
 Detects collision during rightward movement. More...
 

Detailed Description

This module can be used in terminal-based games to add buildings and check collisions between them an any char_object_t.

game How to Use: Create an object of type building_t in the location you want it to be printed. Every time a char_object_t moves in a specific direction, call the respective Game_Collision function on each building and the char_object_t.

Author
Alex Marino

Typedef Documentation

typedef struct building_t building_t

Enum to store collision type for use with building_t.

Use these values to determine if a collision occurs or if the object is in a doorway If DOOR is detected, user should produce 2 movements so that the object moves through the door, as the object could move upwards or downwards through the door if it stays in the doorway

Enumeration Type Documentation

Enum to store collision type for use with building_t.

Use these values to determine if a collision occurs or if the object is in a doorway If DOOR is detected, user should produce 2 movements so that the object moves through the door, as the object could move upwards or downwards through the door if it stays in the doorway

Enumerator
NO_COLLISION 
COLLISION 
DOOR 

Function Documentation

enum check_collision Game_CollisionDown ( building_t  building,
char_object_t  player 
)

Detects collision during downward movement.

Parameters
buildingis a building_t
playeris any char_object_t whose position might conflict with a building
enum check_collision Game_CollisionLeft ( building_t  building,
char_object_t  player 
)

Detects collision during leftward movement.

Parameters
buildingis a building_t
playeris any char_object_t whose position might conflict with a building
enum check_collision Game_CollisionRight ( building_t  building,
char_object_t  player 
)

Detects collision during rightward movement.

Parameters
buildingis a building_t
playeris any char_object_t whose position might conflict with a building
enum check_collision Game_CollisionUp ( building_t  building,
char_object_t  player 
)

Detects collision during upward movement.

Parameters
buildingis a building_t
playeris any char_object_t whose position might conflict with a building
void Game_DrawBuilding ( building_t  building)

Function to draw buildings with doors.

Parameters
buildingis a building_t that stores building parameters

Here is the call graph for this function: