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 the turrets


Now that we have a level, we need to add a turret. Double-click on the background, select add sprite, and then add the graphic. Make sure that the dimension of this graphic is 32 by 32; everything that we had set up earlier needs to be on this grid. Your playing area should look like the following screenshot:

First, we will add some functionality using the following steps:

  1. Add a Touch object from the Insert New Object window.

  2. Then, go to your event sheet and add an event. This event is going to be a Touch event. Remember that touch events and mouse clicks are the same.

    Tip

    It's better to set up the touch event for simple clicks. Now, people on mobile devices can play your game.

  3. When we touch the black area, a turret is spawned. This will spawn a turret on the screen. Add an On touched object event, as shown in the following screenshot:

  4. The object we want to be touched is the PlaceTurret object, as shown in the following screenshot:

  5. Click on the Done button and your project...