Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Adventure_game/player.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
110 lines (77 sloc)
1.55 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef PLAYER_H | |
#define PLAYER_H | |
#include "functions.h" | |
#include <iostream> | |
#include <string> | |
#include "Windows.h" // Library for sleep timer | |
#include <iomanip> // Library for setw | |
using namespace std; | |
class Player | |
{ | |
private: | |
int hp; | |
int def; | |
int hitpow; | |
int coins; | |
public: | |
Player(){ | |
hp = 100; | |
def = 50; | |
hitpow = 20; | |
coins = 200; | |
} | |
void sethp(int hp){ | |
this->hp = hp; | |
} | |
int gethp(){ | |
return hp; | |
} | |
void setdef(int def){ | |
this->def = def; | |
} | |
int getdef(){ | |
return def; | |
} | |
void sethitpow(int hitpow){ | |
this->hitpow = hitpow; | |
} | |
int gethitpow(){ | |
return hitpow; | |
} | |
void setcoins(int coins){ | |
this->coins = coins; | |
} | |
int getcoins(){ | |
return coins; | |
} | |
void attack(int att){ | |
att = att - hitpow; | |
hit = att; | |
} | |
}; | |
/* | |
class Monster | |
{ | |
private: | |
int hp = 50; | |
int hitpow = 10; | |
public: | |
void sethp(int hp){ | |
this->hp = hp; | |
} | |
int gethp(){ | |
return hp; | |
} | |
void sethitpow(int hitpow){ | |
this->hitpow = hitpow; | |
} | |
int gethitpow(){ | |
return hitpow; | |
} | |
void attack(int att){ | |
att = att - hitpow; | |
hit = att; | |
} | |
}; | |
*/ | |
#endif |