Going further
Now, you are probably thinking at this point, "What about the rest of the battle?" Put simply, I leave that up to you.
You are now armed with everything you need to know to be able to complete the rest of the battle scene. You should not just stop there, however, and you should see just how far along you can get.
Try expanding the battle to include various states using the following steps:
Add an onscreen GUI to inform that the control is now changing hands in the Change Control battle state.
Loop through the Goblins and let them attack the player; rough him or her up a bit.
Check whether the battle is complete, and accordingly, either transition back to the Player Move state or set the
BattleReady
state variable tofalse
to transition to the Battle Result state.Display a 2D GUI to summarize the battle results and grant the user some experience, perhaps with some gold, each time an enemy is slain.
Transition back to the map when the battle is over.