![]() |
HeadBall
1.0
A game
|
Derived class of State class with visibility mode public that includes main gameplay. More...
#include <GameState.hpp>


Public Member Functions | |
| GameState (GameDataRef data, ScoreTimeRef scoretime, bool is2ndHalf=false) | |
| Construct a new Game State object. More... | |
| void | init () |
| Initialize a new GameSate Object. More... | |
| void | handleInput () |
| Handles all the inputs of Game State. More... | |
| void | update () |
| Updates the rendering window according to the provided input. More... | |
| void | draw () |
| Draws all the SFML object in the rendering window. More... | |
| void | pause () |
| Pauses the game. More... | |
| void | resume () |
| Resumes the game. More... | |
| void | animate (std::string player) |
| Animates the movement of the players. More... | |
| void | kick (std::string player) |
| Kicks the ball when called by the player. More... | |
| virtual void | animate () |
| Vitrual function for performing animations. More... | |
Private Attributes | |
| GameDataRef | _data |
| The shared pointer of GameData. More... | |
| sf::Text | _timeText |
| sf::Text | _p1Score |
| sf::Text | _p2Score |
| The SFML text of Score and Time. More... | |
| ScoreTimeRef | _scoreTime |
| The shared pointer of ScoreTimeData. More... | |
| WorldRef | _world = std::make_shared <b2World> (b2Vec2(WORLD_GRAVITY_X, WORLD_GRAVITY_Y)) |
| The shared pointer of Box2d world. More... | |
| Ground | _ground |
| The Ground object. More... | |
| UpHill | _leftUpHill |
| UpHill | _rightUpHill |
| The Uphill objects. More... | |
| Wall | _wall |
| The Wall objects. More... | |
| GoalPost | _leftPost |
| GoalPost | _rightPost |
| The GoalPost objects. More... | |
| Player | _p1 |
| Player | _p2 |
| The Player objects. More... | |
| Ball | _ball |
| The Ball objects. More... | |
| bool | _isPaused |
| The boolean variable to if the game is paused. More... | |
| bool | _isSecondHalf |
| The boolean variable to check if the state is second half or not. More... | |
| sf::Sprite | _pauseBtn |
| Sprite for pause button. More... | |
| sf::Music | _crowdCheerSfx |
| Crowd cheer sound. More... | |
| sf::Sound | _btnClickSfx |
| Sound effect for button click. More... | |
| sf::Sound | _longWhistleSfx |
| Sound effect to play at the end of each half. More... | |
| sf::Sound | _shortWhistleSfx |
| Sound effect to play at the start of every half and after every goal. More... | |
| sf::Sound | _playerKickSfx |
| Sound effect to play when the ball is kicked. More... | |
| int | _p1MoveCounter |
| The int variable to count Player1 movement. More... | |
| int | _p2MoveCounter |
| The int variable to count Player2 movement. More... | |
Derived class of State class with visibility mode public that includes main gameplay.
| HeadBall::GameState::GameState | ( | GameDataRef | data, |
| ScoreTimeRef | scoretime, | ||
| bool | is2ndHalf = false |
||
| ) |
Construct a new Game State object.
| data | The shared pointer of GameData |
| scoretime | The shared pointer of ScoreTimeData |
| is2ndHalf | The bool variable with default value false |
|
inlinevirtualinherited |
Vitrual function for performing animations.
| void HeadBall::GameState::animate | ( | std::string | player | ) |
Animates the movement of the players.
| player | String object whose value is either "p1" or "p2" |
|
virtual |
Draws all the SFML object in the rendering window.
Implements HeadBall::State.
|
virtual |
Handles all the inputs of Game State.
Implements HeadBall::State.
|
virtual |
Initialize a new GameSate Object.
Implements HeadBall::State.
| void HeadBall::GameState::kick | ( | std::string | player | ) |
Kicks the ball when called by the player.
| player | String object whose value is either "p1" or "p2" |
|
virtual |
Pauses the game.
Reimplemented from HeadBall::State.
|
virtual |
Resumes the game.
Reimplemented from HeadBall::State.
|
virtual |
Updates the rendering window according to the provided input.
Implements HeadBall::State.
|
private |
Sound effect for button click.
|
private |
Crowd cheer sound.
|
private |
The shared pointer of GameData.
|
private |
The boolean variable to if the game is paused.
|
private |
The boolean variable to check if the state is second half or not.
|
private |
|
private |
|
private |
Sound effect to play at the end of each half.
|
private |
|
private |
The int variable to count Player1 movement.
|
private |
|
private |
The int variable to count Player2 movement.
|
private |
The SFML text of Score and Time.
|
private |
Sprite for pause button.
|
private |
Sound effect to play when the ball is kicked.
|
private |
The Uphill objects.
|
private |
The shared pointer of ScoreTimeData.
|
private |
Sound effect to play at the start of every half and after every goal.
|
private |
|
private |
The shared pointer of Box2d world.