Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Construct 2 Game Development by Example
  • Table Of Contents Toc
Construct 2 Game Development by Example

Construct 2 Game Development by Example

By : John Bura
3.8 (9)
close
close
Construct 2 Game Development by Example

Construct 2 Game Development by Example

3.8 (9)
By: John Bura

Overview of this book

This book uses practical examples to teach readers, and imparts the key skills and techniques of working in Construct 2 through building complete game projects. This book is for complete beginners who have always wanted to learn how to make games and have never tried. It is the perfect introduction to game development, design, and production.
Table of Contents (11 chapters)
close
close
9
A. Where to Go from Here
10
Index

Variables in JavaScript

Construct 2 exports to HTML5, and this means that a lot of the functionality in the game is written in JavaScript. In JavaScript, the type of variable is not defined until you initialize it. While this makes programming in JavaScript much easier, it has its pros and cons. The biggest con is that sometimes you forget which variables are of what type, which leads to unexpected results when you run the app.

Examining JavaScript code

JavaScript is a very popular web language. It is much easier to code in than most other programming languages.

Let's take a look at some examples of JavaScript code.

var score;
var timescale = 1.2;
var name = "John Bura";
var playerName;

You will notice that all of the variables are simply called var instead of Int, Bool, String, or Real. This means that, until you initialize the variable, var can be whatever you want it to be.

So in this case, score is not a number—it is simply a variable. However, timescale is a number...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Construct 2 Game Development by Example
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon