|
Wolf3D
|
Public Types | |
| enum | state { DIE = 0 , PAIN = 4 , IDLE = 6 , SHOOT = 14 , WALK = 17 } |
| States that the Enemy's animation could be in. | |
Public Member Functions | |
| Enemy (int id, std::string type, double position_x, double position_y, double direction, Player *player, std::vector< std::vector< int >> *world_map) | |
| Construct the Enemy object. More... | |
| double | calculate_rotation (double position_x, double position_y, bool angle=false) |
| Calculate the rotation of the Enemy relative to a target's Postion X/Y. More... | |
| void | ai (double *position_x, double *position_y, std::vector< std::vector< int >> *world_map, json *sprite) |
| Perform the Enemy's Artificial Intelligence. More... | |
| void | handle_shot (double *position_x, double *position_y) |
| A subset of the Enemy's Artificial Intelligence for when the Player shoots within a certain range to the Enemy. More... | |
| std::pair< bool, double > | line_of_sight (double *position_x, double *position_y, std::vector< std::vector< int >> *world_map) |
| Calculating if the Enemy has Line of Sight with the provided coordinates and wall collisions with the world map. More... | |
| int | get_id () |
| Get the Enemy's id. More... | |
| std::string | get_type () |
| Get the Enemy's type. More... | |
| double | get_position_x () |
| Get the Enemy's position x. More... | |
| double | get_position_y () |
| Get the Enemy's position y. More... | |
| int | get_direction () |
| Get the Enemy's direction. More... | |
| void | set_rotation (int rotation) |
| Set the Enemy's rotation. More... | |
| double | get_health () |
| Get the Enemy's health. More... | |
| double | remove_health (double health) |
| Remove health from the Enemy's health. More... | |
| void | set_health (double health) |
| Set the Enemy's health. More... | |
| bool | is_alive () |
| If the Enemy is alive. More... | |
| int | get_state () |
| Get the Enemy's animation state. More... | |
| void | set_state (int state) |
| Set the Enemy's animation state. More... | |
| void | play_sound (int sound, double arg0) |
| Play a sound effect. More... | |
| void | set_tracking_player (bool tracking_player) |
| Set if the Enemy is tracking the Player. More... | |
| void | init_texture (RenderWindow *window) |
| Load the textures into memory. More... | |
| std::vector< Uint32 > | get_texture () |
| Get the Enemy's current texture accounting for their state. More... | |
| void | update () |
| Update the timer. | |
| Enemy::Enemy | ( | int | id, |
| std::string | type, | ||
| double | position_x, | ||
| double | position_y, | ||
| double | direction, | ||
| Player * | player, | ||
| std::vector< std::vector< int >> * | world_map | ||
| ) |
| void Enemy::ai | ( | double * | position_x, |
| double * | position_y, | ||
| std::vector< std::vector< int >> * | world_map, | ||
| json * | sprite | ||
| ) |
| double Enemy::calculate_rotation | ( | double | position_x, |
| double | position_y, | ||
| bool | angle = false |
||
| ) |
Calculate the rotation of the Enemy relative to a target's Postion X/Y.
| position_x | The target's Position X |
| position_y | The target's Position Y |
| angle | If false, return the rotation (1-8). If true, return the angle (0-359) |
| int Enemy::get_direction | ( | ) |
Get the Enemy's direction.
| double Enemy::get_health | ( | ) |
Get the Enemy's health.
| int Enemy::get_id | ( | ) |
Get the Enemy's id.
| double Enemy::get_position_x | ( | ) |
Get the Enemy's position x.
| double Enemy::get_position_y | ( | ) |
Get the Enemy's position y.
| int Enemy::get_state | ( | ) |
Get the Enemy's animation state.
| std::vector< Uint32 > Enemy::get_texture | ( | ) |
| std::string Enemy::get_type | ( | ) |
Get the Enemy's type.
| void Enemy::handle_shot | ( | double * | position_x, |
| double * | position_y | ||
| ) |
| void Enemy::init_texture | ( | RenderWindow * | window | ) |
Load the textures into memory.
| window | RenderWindow Renderer to use to load the textures from |
| bool Enemy::is_alive | ( | ) |
| std::pair< bool, double > Enemy::line_of_sight | ( | double * | position_x, |
| double * | position_y, | ||
| std::vector< std::vector< int >> * | world_map | ||
| ) |
Calculating if the Enemy has Line of Sight with the provided coordinates and wall collisions with the world map.
| position_x | The Player's Position X |
| position_y | The Player's Position Y |
| world_map | The vector of the world map |
| void Enemy::play_sound | ( | int | sound, |
| double | arg0 | ||
| ) |
Play a sound effect.
| sound | The corresponding ::state of the sound effect to play |
| arg0 | Argument 0 for sound effect playback |
| double Enemy::remove_health | ( | double | health | ) |
| void Enemy::set_health | ( | double | health | ) |
| void Enemy::set_rotation | ( | int | rotation | ) |
| void Enemy::set_state | ( | int | state | ) |
| void Enemy::set_tracking_player | ( | bool | tracking_player | ) |