Book Image

Sparrow iOS Game Framework Beginner's Guide

By : Stein
Book Image

Sparrow iOS Game Framework Beginner's Guide

By: Stein

Overview of this book

An easy-to-follow guide full of descriptive step-by-step procedures on how to develop a game for iOS. With each topic, a new challenge will be tackled to get a deeper knowledge of the Sparrow game framework and gain the skills to develop a complete mobile experience. This book is aimed at those who have always wanted to create their own games for iOS devices. Perhaps you've already dabbled in game development and want to know how to develop games for the Apple App Store, or maybe you have developed Objective-C apps in the past but you are new to game development. In either case, this book will help with descriptive examples and teach you to develop a game throughout its course. Some experience in Objective-C and a basic understanding of object-oriented programming are required.
Table of Contents (15 chapters)
13
Afterword
14
Index

Adding buttons to the screen


Now that we have hit point bars on the screen, let's add some things that the user can actually interact with.

Pausing and resuming the game

The first thing we are going to add is the ability to pause and resume the game at will. This is actually quite important, especially for mobile action games. If a call comes on the mobile device (iPhone) and we don't have a pause functionality, the player might get frustrated by not being able to pause the game and lose their progress or winning streak.

Before we get into implementing these buttons, let's download the necessary graphics for this chapter which are available at https://github.com/freezedev/pirategame-assets/releases/download/0.7/Graphics_07.zip. Copy the contents of the extracted file into the project.

Let's think of what we need to do when pausing the game:

  • Display a button to pause the game

  • Display a button to resume the game

  • Stop all current tweens when the player clicks on the pause button

  • Resume all current...