In this .cpp i have an error saying member function cannot be redeclared. I dont know what it needs to get rid of the error obviously it needs a declaration somewhere but where?
#include <iostream>
#include <ctime>
using namespace std;
Monster::Monster(std::string Name, int health, int hitPoints,
int miss, int damage,const std::string& weaponName)
{
Name = Name;
hitPoints = hitPoints;
Weapon weapon;
miss = miss;
damage = damage;
weapon.Name = weaponName;
}
bool Monster::Death()
{
return hitPoints <= 0;
}
std::string Monster::getName()
{
return Name;
}
void Monster::attack(Player& player)
{
{
srand((unsigned)time(0));
int random_integer;
for(int index=0; index<1; index++){
random_integer = (rand()%2)+1;
cout << random_integer << endl;
}
cout << "A " << Name << " attacks you "
<<"with a " << weapon.Name << endl;
int damage = weapon.weaponHitPoints;
if(random_integer = 1)
{
Player.takeDamage;
cout << "Your Health is minus: " << damage;
}
else if( random_integer = 2)
{
cout<< "You missed";
}
void Monster::takeDamage(int damage)
{
HitPoints -= damage;
}
void Monster::displayHitPoints()
{
cout << Name << "'s hitpoints = " << HitPoints << endl;
}
}