You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
568 B

  1. #include "Player.h"
  2. Player::Player(std::string name)
  3. : name_{name}
  4. {}
  5. const std::string& Player::getName() const {
  6. return name_;
  7. }
  8. uint32_t Player::getHighScore() const {
  9. return high_score_;
  10. }
  11. void Player::play(){
  12. Controller controller;
  13. while (controller.wantsToQuit() == false) {
  14. controller.readInput();
  15. if (controller.act() == DEFEAT) {
  16. break;
  17. }
  18. }
  19. const uint32_t score = controller.getCurrScore();
  20. controller.resetScore();
  21. if (score > high_score_) {
  22. high_score_ = score;
  23. }
  24. }