Cleaning Up
Last updated
Last updated
If you've made it this far through the RockBlaster tutorials, congratulations! We've covered a lot of topics in Glue and FlatRedBall. This last tutorial will clean up the game. All games require some polish and clean up before being finished. Normally this phase of game development takes a lot longer and covers far more than this tutorial, but we'll keep it short to focus on Glue and FlatRedBall features.
All entities with collision currently draw their circles. This is useful for understanding how large the collision area is and to identify bugs, but we need to turn off the shapes before marking the game as finished. To do this:
In Glue, expand the Bullet Entity
Expand the Objects item under Bullet
Select CircleInstance
Select the Variables tab
Uncheck the Visible property
Repeat this process for:
CircleInstance in Player
CircleInstance in Rock
Now our game looks much better without the white circles:
If the user dies currently the game simply sits there and doesn't let the player know what's going on. We can add an end-game UI in Gum to announce that the game has ended.
Open Gum
Drag+drop a Text object from the Standards folder onto GameScreenGum
Rename the Text to GameOverAnnouncement
Change the Text property on GameOverAnnouncement to Game Over. You may need to press the TAB key to apply the changes to the Text property. Pressing the Enter key results in a newline being added to the Text.
Click the Alignment tab and then click the Center Anchor button
Now that we've adjusted the position, we can set GameOverAnnouncement to be invisible by unchecking the Visible property under the Variables tab.
Just like with the score hud, we will access the GameOverAnnouncement in Glue:
Expand GameScreen in Glue
Expand the Files folder
Drag+drop GameScreenGum onto the Objects folder
Use the drop-down to select GameOverAnnouncement
Click OK
Next we'll want to detect if the game is over and show the hud if so. To do this:
Open GameScreen.cs in Visual Studio
Add the following to the CustomActivity in GameScreen.cs:
Next we'll want to implement EndGameActivity. To do this:
Add the following code to GameScreen.cs in the GameScreen class:
Now the GameOver will appear after all ships have died. If you have increased the ship's health you will want to reduce it back to a reasonable number (like 6). This is important for the final state of the game as well as it will help you test the end game logic quicker.
Not that we have the accumulation fixed we will need to remove the debugger code. To do this, open Game1.cs and locate the calls to the FlatRedBall.Debug.Debugger and remove those lines.
Way to go! You've just finished the RockBlaster tutorial series. We've covered a lot of features that are commonly used in FlatRedBall games. Of course there's always more you can do to a game, and now that you've come this far we encourage you to experiment with the game. Here's some things to try, some simple, and some more complex:
Modifying the way the bullets fire. Possible ideas include
A machine-gun that fires rapidly when holding the fire button down
Spread fire
Bullets which use different graphics and do area damage when exploding
Make the rocks rotate randomly
Add borders to the edge of the level so the player can't leave the screen
Stop rock spawning when the game has ended
Add a background to the GameScreen
Allow the user to restart the level by pushing a button when the game ends
Create an Explosion entity that shows whenever Rocks or the Player are destroyed
There are endless possibilities. Good luck!