Chapter    3

Creating a Game World

This chapter will show you how to create a game world by storing information in memory. I will introduce basic types and variables and how they can be used to store or change information. Next, you will see how to store more complicated information in objects that consist of member variables and methods.

Basic Types and Variables

The previous chapters discussed memory a couple of times. You have seen how to execute a simple instruction like backgroundColor = UIColor.blueColor() to set the background color of the app screen to a certain value. In this chapter’s example, you will use memory to store information temporarily, in order to remember the results of a few simple calculations.

Types

Types, or data types ...

Get Swift Game Programming for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.