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

Introducing variables


Computer programming is based on mathematical principles. After all, the first computer was made to actually calculate equations, and it was only later that applications (as we know them) were developed. You have probably heard of variables in science and math classes. In computers, these variables are necessary to make applications and they are very important in games. Even a small indie game might have hundreds of variables.

Variables are places where you can store small amounts of data. This data can be a name, a number, a date, a game object, or it can even store true or false information. Variables are essential to games because they can store items such as the following:

  • Score

  • Player name

  • Game objects

  • Mouse position

  • Keyboard input

In order to store data, you have to store data in the right kind of variables. We can think of variables as boxes, and what you put in these boxes depends on what type of box it is.

In most native programming languages, you have to declare a...

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