嘿,基本上我希望玩家和狼互相攻击,直到彼此死亡。但是while循环是无限的,所以显然条件不满足。但我看不出我哪里出了问题 if (choice1 == 1) // if 语句在整个游戏中使用,以允许用户通过游戏与选择进行交互。
while((Status.health != 0) && (Wolves.health != 0) )
{
int playerAttack = Status.strength + hitPoints() + Rock.attack;
cout<< "This is the player attack" << playerAttack;
Wolves.health = Wolves.health - playerAttack;
cout << "This is the wolves health" << Wolves.health;
if (Wolves.health <= 0)
{
cout << "\nThe wolves are dead\n ";
}
int wolfAttack = Wolves.attack + hitPoints();
Status.health - wolfAttack;
if(Status.health <= 0)
{
gameOver();
}// print out of object health.
}
有人可以帮忙吗?