This chapter will be a short one. When the game detects that conditions for GameOver are met, we basicaly have to stop the game play, and let the user know it's over. This would be a good time to process the score, and see if the player made it to the hall of fame… I know, I know… We don't have a High Score list. Not yet! We'll come to it somewere near the end of this tutorial. So, I'll just put the code for the GameOver() method here, so we could move on to another fun part of the tutorial – Chasing the mouse over the field.
// First, we stop the game play
// by stopping the Game timer.
Game.Enabled = false;
// Then we display the Game Over
// message.
lblDisplay.Visible = true;
I hope you didn't try to run your program yet. I forgot to tell you: You need another label on your form. So, back to the design view, add a label, and adjust it to meet these specifications:
Label
- (name): lblDisplay
- Autosize: False
- BackColor: Web > Transparent
- Font: Arial Black; 27,75pt; style=Bold
- Forecolor: Web > Red
- Location: 12; 388
- Size: 600; 52
- Text: GAME OVER!
- TextAlign: TopCenter
- Visible: False
Right. Now we're ready to test our game. It should show the 'Game Over' message when the game field fills with columns. Here's a screenshot of how the game should look at this stage: (Huh, notice that I forgot to select the 'Show Grid' check box)
Next:
Heeeeereeee mousey! Heeere mousey… I'll catch you this time… Just wait and see… ;o)
0 comments:
Post a Comment