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

Setting up an enemy wave


We need to set up the amount of green balls that get spawned. When we push the WaveButton, a new wave should start. Let's go ahead and add a global variable by right-clicking on the event sheet and adding a global variable. Let's call it waveCount and set its Initial value to 3, as shown in the following screenshot:

Create another variable called ballCount. Set its Initial value to 0. The wave count is going to count how many total green balls are going to be spawned in a wave, and the ball count will count how many balls are on screen. We need both of these variables in order to make it work. Generally, you want to try and use the least amount of variables as possible—but often the least amount can still be a lot of variables. Even in some small games I've seen, the variable count exceeds 200.

Once you have created this global variable, let's use it. Add an event to the green ball and select the On created event, as shown in the following screenshot:

Once you have...