Created the Player.cpp and Player.h that will be used as player class in the game.

This commit is contained in:
Gustavo Henrique Santos Souza de Miranda 2024-09-27 01:12:43 -03:00
parent 9bd09b0483
commit 7887ee2678
2 changed files with 59 additions and 0 deletions

33
src/Player.cpp Normal file
View File

@ -0,0 +1,33 @@
//
// Created by gustavomiranda on 27/09/24.
//
#include "Player.h"
int Player::getCurrentMoney() {
return money;
}
void Player::incrementMoney(int value) {
money += value;
}
void Player::decrementMoney(int value) {
if(money >= value){
money -= value;
}
}
Bag* Player::getInventory(){
return inventory;
}
Player::Player(){
setMoney(2500);
inventory = new Bag(100);
}
Player::~Player() {
delete inventory;
}

26
src/include/Player.h Normal file
View File

@ -0,0 +1,26 @@
//
// Created by gustavomiranda on 27/09/24.
//
#ifndef DRUGWARS_PLAYER_H
#define DRUGWARS_PLAYER_H
#include "Bag.h"
class Player {
private:
int money;
Bag * inventory;
void setMoney(int value);
public:
Player();
~Player();
int getCurrentMoney();
void incrementMoney(int value);
void decrementMoney(int value);
Bag *getInventory();
};
#endif //DRUGWARS_PLAYER_H