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 path for the enemy


Next, we need to add the spawning green balls that are our enemy sprites, and in order to do that we need to add the Pathfinding behavior. Pathfinding sets a path from one area to another. We are going to use the Pathfinding functionality of Construct 2 to make the balls move from the start to the finish line. Add a Pathfinding behavior to the green ball, as shown in the following screenshot:

Once you have done this, go back to the event sheet and add an On start of layout event, as shown in the following screenshot:

After that, add an action. Select the BallGreen object and select Find path as the action, as shown in the following screenshot. In order to set the path, you have to first set it. You can set the path to positions of objects, inputs such as touch and mouse, and specific locations.

We have to specify where we want the path to go. Since we want the green balls to go all the way to the end of the path, we can type in End.X and End.Y, as shown in...