Keeping score
Most good games have a mechanism built in to keep track of scoring. We're now going to take the game we've been working on and integrate some scoring.
We also have duplicated several of our sprites, so we now have six bouncing balls on the stage. You may choose to follow our lead, or you may not, that part is up to you.
The primary way we'll change the score in this game is by having the score increase by one point for each ball you successfully bounce. We know this leaves you open to the possibility to cheat in the game, but hey, this is the basic gaming section right?
Getting ready
For this recipe, you can use either the version of the game we created in the last recipe, or the version from the User interaction with a game recipe. We're going to use the version that has the mouse control involved, and not the one with arrow keys.
How to do it...
We'll start off by increasing our score by one point each time we hit a ball with the red bar.
To increase the score, perform the following...