I my trying to make a simple d&d game and I hit a point where it is giving me these errors Invalid use of non-static data member 'health' and several other class members. how do I fix this problem? here's my code.
void no(){
time_t current_time = time(NULL);
srand((unsigned) time(NULL));
int bugstar = (((rand() % 8) + (rand() % 8)) + 2);
int bujaveline = (((rand() % 2) + (rand() % 2)) + 4);
int bugjaveline2 = ((rand() % 6) + 2);
int bugstarboss = (((rand() % 8) + (rand() % 8)) + 3);
int bujavelineboss = (((rand() % 2) + (rand() % 2)) + 3);
int bugjavelineboss2 = ((rand() % 6) + 3);
}
int main()
{
BugBearBoss{
health = 65;//error here
armour = 17;//error here
attack = "bugstarboss"; //error here
attack1 = "bujavelineboss";//error here
attack2 = "bugjavelineboss2";//error here
}
BugBear{
health = 27;//error here
armour = 16;//error here
attack = "bugstar";//error here
attack1 = "bujaveline";//error here
attack2 = "bugjaveline";type here//error here
}}
these are my classes for each of the items that contain the errors here is the code for the classes.
using namespace std;
class BugBearBoss{
public:
string weakness;
int health;
int armour;
int attack;
int attack1;
int attack2;
};
class BugBear{
public :
string weakness;
int health;
int armour;
int attack;
int attack1;
int attack2;
};
I've tried making the void function a int function and and removing int main but each has its own set of errors.
now I get use of undeclared identifier BugbearBoss, as well as invalid use of non static data member "armour"