Skip to content
Snippets Groups Projects
Commit 90c8f12b authored by Ian Prins's avatar Ian Prins
Browse files

add base class mob for players/monsters

parent ab41faa2
No related branches found
No related tags found
Loading
#include "coord.h"
#include <string>
#ifndef MOB_H
#define MOB_H
class Mob {
public:
Mob(std::string, Coord);
Coord getCoord();
std::string getName();
private:
std::string name;
Coord coord;
};
#endif
#include <string>
#include "coord.h"
#include "itemzone.h"
#include "mob.h"
#ifndef PLAYERCHAR_H
#define PLAYERCHAR_H
class PlayerChar {
class PlayerChar : Mob {
public:
int getStrength();
int getArmor();
std::string getName();
int getGold();
int getHP();
int getMaxHP();
Coord getCoord();
int getLevel();
private:
int HP;
......@@ -21,8 +20,6 @@ class PlayerChar {
int armor;
int strength;
int gold;
std::string name;
Coord coord;
ItemZone backpack;
int level;
};
......
#include "include/mob.h"
#include "include/coord.h"
#include <string>
Mob::Mob(std::string name, Coord coord)
: name(name)
, coord(coord)
{}
Coord Mob::getCoord() {
return coord;
}
std::string Mob::getName() {
return name;
}
......@@ -26,14 +26,6 @@ int PlayerChar::getGold() {
return gold;
}
std::string PlayerChar::getName() {
return name;
}
Coord PlayerChar::getCoord() {
return coord;
}
int PlayerChar::getLevel() {
return level;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment