Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Construct 2 Game Development by Example

You're reading from   Construct 2 Game Development by Example Learn how to make games for multiple platforms with Construct 2.

Arrow left icon
Product type Paperback
Published in Jun 2014
Publisher
ISBN-13 9781849698061
Length 230 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
John Bura John Bura
Author Profile Icon John Bura
John Bura
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with Construct 2 FREE CHAPTER 2. Inputs and Controls 3. Variables and Arrays 4. Game Mechanics 5. Making a Simple Shooter 6. Making a Tower Defense Game 7. Making a Puzzle Physics Game 8. Exporting Your Game A. Where to Go from Here
Index

Rotating the turret


Now we need to make the turret rotate to the green ball. Go to the event sheet, click on Add event, select System, and then select the Every tick event.

Once you have these changes in your event sheet, you can add an action to the turret. Go to the Add action sheet and add the Rotate toward position action.

In the Parameters for Turret window, set the Degrees textbox to 10. This is the speed with which the turret will rotate. You generally want a high rotation speed so that the turret can rotate on time. Remember that the turret does indeed rotate towards the object. It is best to have this speed as fast as possible because if it is too slow, then the turret will not be able to aim and hit the target. In the X textbox, type BallGreen.X and type BallGreen.Y in the Y textbox, as shown in the following screenshot. This rotates the X and Y position of the green ball.

Your project should now look like the following screenshot:

Go ahead and test the game. Add a turret and see whether...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image