I wrote a game that's like the old Final Fantasy 1, 2, etc.
I tried to make the game... like there are two foes and two home units. You can only do damage to one of the enemy units with each turn of one of your players.
If any one of the unit dies, it ends the game.
BTW, b and w are the enemies. Vex and Fel are friendly units. Each unit has a certain amount of health and when it reaches 0 they die.
But for some reason it just goes on and on. And for some reason it displays some random thing instead of the health (something like 0x530c530 or something)
The while loop keeps going as long as all of the healths are not equal to 0. Even if one gets down to zero, this while loop keeps going because the other conditions are true. If the game is supposed to end when the first health gets to zero, I might have a single game over flag and set that to true as soon as one of the healths gets set to 0 during game play. Then run the while loop on that single flag.
I'm not sure if you saw my edited post. Re-reading the description of the game, it's supposed to end when just one player hits 0, not all of them hitting zero ? I'd keep the while loop simple and add a single game over flag to check.
Or, if you really want to keep the different conditions in the while, it can be tweaked like this. while (!(b_health == 0 || Fel_health == 0 || Vex_health == 0 || w_health == 0))