From 4da9880fbf5497be999fe9b2f01e5d6c30c41a8a Mon Sep 17 00:00:00 2001 From: "Peter Marek (marekp)" Date: Wed, 27 May 2020 16:05:40 +0200 Subject: [PATCH] Create EmenyClass.cpp --- EmenyClass.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 EmenyClass.cpp diff --git a/EmenyClass.cpp b/EmenyClass.cpp new file mode 100644 index 0000000..e07aa27 --- /dev/null +++ b/EmenyClass.cpp @@ -0,0 +1,43 @@ +#pragma once +#include +#include +using namespace std; + +class Enemy { +private: + int health; + int attack; + int defence; + string weapon; +public: + //getters + int getEnemyHealth() { return health; } + int getEnemyAttack() { return attack; } + int getEnemyDefence() { return defence; } + string getEnemyWeapon() { return weapon; } + + + Enemy(int, int, int, string); + + void abilities(){ + cout<<"- Execute \n- Charge \n- Reflect "<getEnemyHealth() << endl; + cout << "Attack: " << this->getEnemyAttack() << endl; + cout << "Defence: " << this->getEnemyDefence() << endl; + cout << "Weapon: " << this->getEnemyWeapon() << endl; + + } +}; + +// A constructor is called when an object is created +Enemy::Enemy(int health, int attack, int defence, + string weapon) { + // This is used to refer to an object created of this class type + this->health = health; + this->attack = attack; + this->defence = defence; + this->weapon = weapon; +}