void DrawComputer(GameTime gameTime)
Finally, we must make the GameplayScreen class render both players. Open the GameplayScreen.cs file and navigate to the “Draw” method. Remove the comments on the lines which call the “DrawComputer” and “DrawPlayer” helper methods. The relevant portion of the code should now look like this:
Compile and deploy the project. After navigating to the game screen, the catapults should now be visible:
The catapults can now be seen
This concludes the first task of this exercise. During the next task we will implement the game’s logic, as right now the game merely draws its various elements to the screen.
Task 2 – Game logic
In the course of this task, we will add many elements that are still missing from the game. We will add a turn cycle alternating between the human and computer players, giving each a chance to take a shot at the enemy. This will include adding projectiles and their associated physics, handling user input, writing the AI logic and so on.
Page | 49