![]() |
The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
|
Represents a player in the game with name and score tracking. More...
#include <user.hpp>
Public Member Functions | |
int | get_round () const |
Gets the current round number. | |
const std::string & | get_user_name () const |
Gets the user's name. | |
int | get_user_score () const |
Gets the current score of the user. | |
void | increment_score () |
Increments the user's score by 1. | |
void | reset_score () |
Resets the user's score to 0. | |
void | set_round (int _round) |
Sets the current round number. | |
void | set_user_name (const std::string &name) |
Sets the user's name. | |
void | set_user_score (int _score) |
Sets the user's score to a specific value. | |
User (const std::string &name="Player") | |
Constructor for User class. | |
Private Attributes | |
std::string | name |
int | round |
int | score |
Represents a player in the game with name and score tracking.
This class manages player information including their name, score, and round tracking for story mode.
User::User | ( | const std::string & | name = "Player" | ) |
Constructor for User class.
name | The name of the user (defaults to "Player") |
Initializes a user with the given name and sets score and round to 0
name | The name of the user |
int User::get_round | ( | ) | const |
Gets the current round number.
const std::string & User::get_user_name | ( | ) | const |
Gets the user's name.
int User::get_user_score | ( | ) | const |
Gets the current score of the user.
void User::increment_score | ( | ) |
Increments the user's score by 1.
Called when the user wins a round or scores a point
void User::reset_score | ( | ) |
Resets the user's score to 0.
Used when the game is over or when a reset is needed
Used when the game is over or when a score reset is needed
void User::set_round | ( | int | _round | ) |
Sets the current round number.
_round | The round number to set |
void User::set_user_name | ( | const std::string & | newName | ) |
Sets the user's name.
name | The new name for the user |
newName | The new name for the user |
void User::set_user_score | ( | int | _score | ) |
Sets the user's score to a specific value.
_score | The new score to set |
|
private |
The user's name
|
private |
The current round number (used for story mode)
|
private |
The user's current score