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
Learning Construct 2

You're reading from   Learning Construct 2 Design and create your own engaging, extensible, and addictive game using Construct 2

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher
ISBN-13 9781784397678
Length 234 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Aryadi Subagio Aryadi Subagio
Author Profile Icon Aryadi Subagio
Aryadi Subagio
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Storing data in Construct 2


This is usually the time when I teach you to destroy the enemies and add scores to the game. However, because the focus of this chapter is to store data from the game, we'll cover this first. There are four objects we can use to store data in Construct 2: array, dictionary, WebStorage, and XML. We're not going to cover XML in this book, because XML is a bit hard for beginners of programming, but only knowing the first three is enough for you to save data from your game.

Getting to know arrays

An array, in programming context, is a list of ordered things. An array can be a list of all text values, all number values, or a combination of text and numbers. In programming languages, arrays are written as a list of data inside a square bracket; so, in this book, I will also write an array in such a way. For example, an array of countries will be ["Canada", "USA", "Russia", "Italy", "Germany", "England"], while an array of numeric values will be [100, 250, 350, 150, 600...

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