I have a monster in my game and i am curious as to how i can make his damage given and take completely random. Heres what i have now:
//edit: Also how would i make a timer, that when it hits 0 from a number like 100, would end the game.
PHP Code:
if (user_x == 5 && user_x == 7)
{
std::cout <<"You see a wolf.\n";
std::cout <<"Fight (F)\nRun (R)\n\n";
if (key == 'F' || key == 'f')
{
std::cout <<"You damage the wolf for 10 health points.\n";
std::cout <<"It is dead. You gain 5 experience points.\n\n";
xp += 5;
}
if (key == 'R' || key == 'r')
{
std::cout <<"You run from the wolf.\n";
std::cout <<"You gain nothing.\n\n";
}
}