-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameCharacter.cpp
47 lines (42 loc) · 1.11 KB
/
GameCharacter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "GameCharacter.h"
GameCharacter::GameCharacter(){}
GameCharacter::GameCharacter(string name, string tag, int currentHealth, int attack, int defense):Object(name,"GameCharacter"){
this->currentHealth = currentHealth;
this->attack = attack;
this->defense = defense;
}
bool GameCharacter::checkIsDead(){
if(currentHealth<=0){
return true;
}
else{
return false;
}
}
int GameCharacter::takeDamage(int takeDamage){
currentHealth -= takeDamage;
}
void GameCharacter::setMaxHealth(int maxHealth){
this->maxHealth = maxHealth;
}
void GameCharacter::setCurrentHealth(int currentHealth){
this->currentHealth = currentHealth;
}
void GameCharacter::setAttack(int attack){
this->attack = attack;
}
void GameCharacter::setDefense(int defense){
this->defense = defense;
}
int GameCharacter::getMaxHealth(){
return this->maxHealth;
}
int GameCharacter::getCurrentHealth(){
return this->currentHealth;
}
int GameCharacter::getAttack(){
return this->attack;
}
int GameCharacter::getDefense(){
return this->defense;
}