48 Enemy(
int id, std::string type,
double position_x,
double position_y,
double direction,
Player *player, std::vector<std::vector<int>> *world_map);
68 void ai(
double *position_x,
double *position_y, std::vector<std::vector<int>> *world_map, json *sprite);
76 void handle_shot(
double *position_x,
double *position_y);
87 std::pair<bool, double>
line_of_sight(
double *position_x,
double *position_y, std::vector<std::vector<int>> *world_map);
212 std::map<std::string, int> fov{
215 std::map<std::string, int> hit_chance{
218 std::map<std::string, int> weapon_damage{
222 int max_fire_distance = 6;
224 int max_view_distance = 15;
226 bool is_shooting =
false;
230 std::vector<Sample *> sound_enemy_die;
232 std::map<std::string, Sample *> sound_enemy_gun;
242 double last_player_x;
243 double last_player_y;
250 bool damaged_player =
false;
253 bool tracking_player =
false;
255 bool hunting_player =
false;
257 AStar::Generator *generator;
258 AStar::CoordinateList hunt_path;
262 int state = state::IDLE;
264 int previous_state = 0;
266 int animation_frame = 0;
273 std::vector<Uint32> enemy_texture[49];
275 std::map<std::string, int> enemy_shoot_textures;
282 double previous_time = 0.0;
285 double shoot_timer = 0.0;
286 double hunt_timer = 0.0;
287 double walk_timer = 0.0;
void set_state(int state)
Set the Enemy's animation state.
Definition: enemy.cpp:400
int get_state()
Get the Enemy's animation state.
Definition: enemy.cpp:399
double get_position_y()
Get the Enemy's position y.
Definition: enemy.cpp:381
int get_id()
Get the Enemy's id.
Definition: enemy.cpp:376
double remove_health(double health)
Remove health from the Enemy's health.
Definition: enemy.cpp:392
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.
Definition: enemy.cpp:43
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 ...
Definition: enemy.cpp:255
void play_sound(int sound, double arg0)
Play a sound effect.
Definition: enemy.cpp:412
void set_health(double health)
Set the Enemy's health.
Definition: enemy.cpp:396
void set_tracking_player(bool tracking_player)
Set if the Enemy is tracking the Player.
Definition: enemy.cpp:455
double get_position_x()
Get the Enemy's position x.
Definition: enemy.cpp:380
void init_texture(RenderWindow *window)
Load the textures into memory.
Definition: enemy.cpp:459
std::string get_type()
Get the Enemy's type.
Definition: enemy.cpp:378
void ai(double *position_x, double *position_y, std::vector< std::vector< int >> *world_map, json *sprite)
Perform the Enemy's Artificial Intelligence.
Definition: enemy.cpp:94
bool is_alive()
If the Enemy is alive.
Definition: enemy.cpp:397
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...
Definition: enemy.cpp:271
int get_direction()
Get the Enemy's direction.
Definition: enemy.cpp:383
void update()
Update the timer.
Definition: enemy.cpp:638
double get_health()
Get the Enemy's health.
Definition: enemy.cpp:391
std::vector< Uint32 > get_texture()
Get the Enemy's current texture accounting for their state.
Definition: enemy.cpp:526
state
States that the Enemy's animation could be in.
Definition: enemy.hpp:29
void set_rotation(int rotation)
Set the Enemy's rotation.
Definition: enemy.cpp:385
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.
Definition: enemy.cpp:5
Definition: player.hpp:19
Definition: renderwindow.hpp:16
Definition: sample.hpp:18
Contains the header functions for the RenderWindow Class.
Contains the header functions for the Enemy Class.