I'm attempting at making a small 2d game just because I'm bored.
I am having an issue however. In the game, when two characters come next to each other, a fight begins. If the fight is with the human character, a JPanel below the map activates that is basically just the fight information and has a button for attacking. When the fight is over, there are a bunch of methods I need to call to clean up the looser and adjust the winner's stats.
In order for that to work, I need to be able to tell my method that manages the battle to wait until one of the fighters loose. Based on my current setup, I have a method called getLooser() that returns either the player that lost or null which indicates neither has lost yet.
I was thinking about doing a while(getLoose()==null) loop that does nothing, but it seems there should be a better way of doing this. Can anyone point me the correct direction?