Implementing the rules
Now, we should pause and think about what we need to do later in the project because it will affect what we do while implementing our rules. When the player's ship is destroyed or when player reaches their goal, the game will end. This implies that the game will need to be restarted. We don't want to quit back to the home screen each time, so we need a way to restart the game from within the TDView
class.
To facilitate this, we are going to implement a startGame
method in our TDView
class. The constructor will be able to call it and our game loop will also be able to call it when necessary as well.
It will also be necessary to pass some of the tasks that the constructor currently performs onto the new startGame
method so that ...
Get Android Game Programming by Example 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.