Finishing up the battle

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.

To complete the battle system, include various states using the following steps:

  1. Destroy enemies with health less than 1.
  2. Loop through the Dragons and let them attack the player; rough her up a bit.
  3. Update the player's health bar to display the correct HP.
  4. Check whether the battle is complete and, accordingly, either transition back to the Player Move state or set the BattleReady state variable to false to transition to ...

Get Mastering Unity 2D Game Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.