Game Scoring

As you'll recall from our earlier discussion of this topic, the first thing you need to do is determine what event(s) will trigger a change in score. For this game, you'll be updating the score whenever the user successfully avoids a three-blade, four-blade, skull ball, or plus sprite. You actually have already added the logic to determine when one of those sprites has been successfully avoided—it lies in the code that deletes the sprites when they disappear off the edge of the screen. If a sprite makes it across the screen and needs to be deleted, that means the user has avoided that sprite, and if it was a three-blade, four-blade, skull ball, or plus sprite, you need to give some points to the user.

Tip

Any time you're developing a game, scoring rules and calculations are things you'll need to think about. You'll most likely formulate an idea, implement it, and then tweak it while testing your game to see if it feels right and plays the way you want it to. For the purposes of this book, the scoring calculations and rules are laid out for you to learn. However, as you begin to feel more comfortable with the concepts in the book and this chapter specifically, feel free to change the rules and tweak the game to whatever feels right to you as both the developer and a player.

In the SpriteManager class, add three new class-level variables representing the three types of sprites you'll be sending at the player, as well as public properties for each variable:

int automatedSpritePointValue ...

Get Learning XNA 3.0 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.