Step 9

Testing and using the ArmoredFighter class


Now that we’ve completed the “ArmoredFighter” class, let’s go ahead and add some code to test it out!

Use the code here as an example to either copy or base your code on. This code will make our enemy an ArmoredFighter. Try it out and see what a difference it makes to the game!

Once you get the hang of it, try and design AdvancedAttacks that work well with the new armor system. The more mechanics we add to the game, the more possiblities we get!

If you are up for a bit of a challenge, try modifying the “Boxer” class to inherit from the “ArmoredFighter” class instead of the “Fighter.” It will take a few changes to the code, but not that many (a lot of it is very similar to what we’ve already done in this project). If you complete the challenge, you’ve truly become a master at inheritance. It also makes the fighters from the Boxer class a lot harder!

Congrats on completing this project! You now have your own basic turn-based RPG combat game! If you really like this, feel free to add on to it. Maybe you could even add some new custom classes of your own!