Book Image

Construct 2 Game Development by Example

By : John Bura
Book Image

Construct 2 Game Development by Example

By: John Bura

Overview of this book

Table of Contents (16 chapters)
Construct 2 Game Development by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Where to Go from Here
Index

Finalizing the game


Let's add some logic in order to finalize winning and losing our game. Often, the finalization of the game is the hardest part. Most indie developers lose interest and stop producing the game.

Losing the game

Add another textbox, make the text say "Game Over", and change the text size so that it's nice and prominent. Place the textbox somewhere prominent and make note of its position.

Then, we need to add a Compare variable event that should compare the variable ballsLeft to be ≤ Less than or equal to 0. Then, set the position of the Game Over text object to the position of the text object noted before.

Make another global variable named isPlaying, as shown in the following screenshot:

Add an action that sets isPlaying to 1 when the ballsLeft variable count is equal or less than zero. Then, add a condition (by pressing C) to the On any click mouse event. The condition is to see whether isPlaying is equal to 0.

Restarting the game on Game Over

When the game is over, we need a...