I'm trying to make a very VERY simple fighting game,
i tried making two classes, with health, attack, avoid(forget about it for now) and heal. This game isn't going to be a turn based game. it will be basicaly. player 1 uses the key "a" to attack and player 2 uses "l" and there are no turns, player 1 can just spam "a" and kill player 2 very fast. So, i was wondering how would it work, im so confused. It appears im making a massive ask, but i really would like some help. I just want to know how to make it so when player 1 presses "a" 3 times, then player 2's health is decreased by 30.
ps: sorry about that code, it doesn't really help at all but im giving what i can =\.
class player1
{
public:
player1():
int health = 100;
int attack = 10;
int avoid = 500;
int heal = 10;
void attackmsg()
{
cout << playername " dealed " attack " damage to" playername2".\n";
}
void avoidmsg()
{
cout << playername " avoided " playername2 "'s attack. \n";
}
void healmsg()
{
cout << playername " has healed " heal "health. \n";
}
}
}
class player2
{
public:
player2():
int health2 = 100;
int attack2 = 10;
int avoid2 = 500;
int heal2 = 10;
void attackmsg2()
{
cout << playername2 " dealed " attack2 " damage to" playername".\n";
}
void avoidmsg2()
{
cout << playername2 " avoided " playername "'s attack. \n";
}
void healmsg2()
{
cout << playername2 " has healed " heal2 "health. \n";
}
}
}
Thank you very much for reading and i will rep you for your answer.

New Topic/Question
Reply



MultiQuote






|