Wolf3D
Public Member Functions | List of all members
Player Class Reference

Public Member Functions

 Player (RenderWindow *window, double *position_x, double *position_y, double *direction_x, double *direction_y, double *plane_x, double *plane_y, std::vector< std::vector< int >> *world_map, json *sprite, std::vector< Enemy * > *enemies)
 Construct the Player object. More...
 
void handle_input (const Uint8 *inkeys, double frameTime)
 Handles the input for the Player, uses both keyboard and a controller. More...
 
void render ()
 Renders the Player's elements and it's children's elements.
 
double get_health ()
 Get the Player's health. More...
 
void hit ()
 Removes the buffered damage from the Player's health, plays the hurt sound effect and displays a red flash.
 
void hit (double damage)
 Removes the provided damage from the Player's health, plays the hurt sound effect and displays a red flash. More...
 
void buffer_damage (double damage)
 Accumulates damage which can be then dealt with hit() More...
 
void clear_buffer_damage ()
 Clear the accumulated damage.
 
double * get_position_x ()
 Get the Player's position x. More...
 
double * get_position_y ()
 Get the Player's position y. More...
 
std::vector< std::vector< int > > * get_world_map ()
 Get the world map. More...
 

Constructor & Destructor Documentation

◆ Player()

Player::Player ( RenderWindow window,
double *  position_x,
double *  position_y,
double *  direction_x,
double *  direction_y,
double *  plane_x,
double *  plane_y,
std::vector< std::vector< int >> *  world_map,
json *  sprite,
std::vector< Enemy * > *  enemies 
)

Construct the Player object.

Parameters
windowThe RenderWindow's Renderer
position_xThe Player's Position X
position_yThe Player's Position Y
direction_xThe Player's Direction X
direction_yThe Player's Direction Y
plane_xThe Camera's Plane X
plane_yThe Camera's Plane Y
world_mapThe vector of the world map
spriteThe "vector" of sprites
enemiesThe vector of enemies

Member Function Documentation

◆ buffer_damage()

void Player::buffer_damage ( double  damage)

Accumulates damage which can be then dealt with hit()

Parameters
damageDamage to accumulate which would be dealt to the Player with hit()

◆ get_health()

double Player::get_health ( )

Get the Player's health.

Returns
double

◆ get_position_x()

double * Player::get_position_x ( )

Get the Player's position x.

Returns
double*

◆ get_position_y()

double * Player::get_position_y ( )

Get the Player's position y.

Returns
double*

◆ get_world_map()

std::vector< std::vector< int > > * Player::get_world_map ( )

Get the world map.

Returns
std::vector<std::vector<int>>*

◆ handle_input()

void Player::handle_input ( const Uint8 *  inkeys,
double  frameTime 
)

Handles the input for the Player, uses both keyboard and a controller.

Parameters
inkeysUint8 of the keys on the keyboard which are held down
frameTimeThe frame time of the program to move/rotate the Player at a contant speed

◆ hit()

void Player::hit ( double  damage)

Removes the provided damage from the Player's health, plays the hurt sound effect and displays a red flash.

Parameters
damageDamage to deal to the Player

The documentation for this class was generated from the following files: