![]() |
HeadBall
1.0
A game
|
Class for shape and movement of player. More...
#include <Player.hpp>

Public Member Functions | |
| Player (GameDataRef data, WorldRef world) | |
| Construct a new Player object. More... | |
| void | init (std::string texture, std::string texturePath, sf::Vector2f position) |
| Initiate the Player object. More... | |
| sf::Sprite | sprite () |
| Return the sprite of the Player object. More... | |
| void | processPosition () |
| Process the position of Player object. More... | |
| void | moveLeft () |
| Move the player left. More... | |
| void | moveRight () |
| Move the player right. More... | |
| void | jump () |
| Make the player jump. More... | |
| void | setTexture (std::string texture) |
| Set the Texture of the sprite. More... | |
Private Attributes | |
| GameDataRef | _data |
| The Shared Pointer of the game data. More... | |
| WorldRef | _world |
| The Shared Pointer of Box2D World. More... | |
| sf::Sprite | _sprite |
| The SFML sprite of the player. More... | |
| b2BodyDef | _bodyDef |
| The definition of Box2D body. More... | |
| b2Body * | _body |
| The Box2D body of player. More... | |
| b2PolygonShape | _rectShape |
| The polygon shape for fixture definition. More... | |
| b2FixtureDef | _fixture |
| The fixture of player for defining its properties. More... | |
Class for shape and movement of player.
| HeadBall::Player::Player | ( | GameDataRef | data, |
| WorldRef | world | ||
| ) |
Construct a new Player object.
| data | Shared pointer of game data |
| world | Shared pointer of Box2D world |
| void HeadBall::Player::init | ( | std::string | texture, |
| std::string | texturePath, | ||
| sf::Vector2f | position | ||
| ) |
Initiate the Player object.
| texture | Texture of the player as defined in the map |
| texturePath | Path to the texture |
| position | Position of the player |
| void HeadBall::Player::jump | ( | ) |
Make the player jump.
| void HeadBall::Player::moveLeft | ( | ) |
Move the player left.
| void HeadBall::Player::moveRight | ( | ) |
Move the player right.
| void HeadBall::Player::processPosition | ( | ) |
Process the position of Player object.
This function processes the position of the sprite as per the position of body in Box2D
| void HeadBall::Player::setTexture | ( | std::string | texture | ) |
Set the Texture of the sprite.
| texture | Texture as defined in the map |
| sf::Sprite HeadBall::Player::sprite | ( | ) |
Return the sprite of the Player object.
|
private |
The Box2D body of player.
|
private |
The definition of Box2D body.
|
private |
The Shared Pointer of the game data.
|
private |
The fixture of player for defining its properties.
|
private |
The polygon shape for fixture definition.
|
private |
The SFML sprite of the player.
|
private |
The Shared Pointer of Box2D World.