embedded-software
reusable software modules for embedded systems
|
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... | |
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.
typedef struct building_t building_t |
typedef enum check_collision check_collision |
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
enum check_collision |
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 |
enum check_collision Game_CollisionDown | ( | building_t | building, |
char_object_t | player | ||
) |
Detects collision during downward movement.
building | is a building_t |
player | is 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.
building | is a building_t |
player | is 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.
building | is a building_t |
player | is 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.
building | is a building_t |
player | is any char_object_t whose position might conflict with a building |
void Game_DrawBuilding | ( | building_t | building | ) |
Function to draw buildings with doors.
building | is a building_t that stores building parameters |