Hello,
What I am trying to do is edit the variable of a class through a separate class function. I have tried to do things like

int player::attack(int *enemy)
{
     srand(time(NULL));
     int randomNumber = rand() % 100;
     *consolePlayer.health = *consolePlayer.health - randomNumber;
}

and I get the error of :
`consolePlayer' undeclared (first use this function)

I know the anser is probably something I've accidentally overlooked, but could you please help?
Thank You,
EpicAsian

Nevermind, I found an alternative that uses pointers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.