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 Sparrow iOS Game Framework Beginner's Guide
  • Table Of Contents Toc
Sparrow iOS Game Framework Beginner's Guide

Sparrow iOS Game Framework Beginner's Guide

By : Stein
4 (1)
close
close
Sparrow iOS Game Framework Beginner's Guide

Sparrow iOS Game Framework Beginner's Guide

4 (1)
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)
close
close
13
Afterword
14
Index

Time for action – using the barebone project as a template

Follow these steps to use the barebone project as a template:

  1. Copy the barebone application from samples | barebone to a location of your choice.
  2. Open the Xcode project.
  3. Click on the project name in the project navigator to make it editable.
  4. Rename it to PirateGame.
  5. Open the Product menu from the top menu bar.
  6. Select Scheme and Manage Schemes.
  7. Rename the Scheme name from Barebone to PirateGame.
  8. Close Xcode.
  9. Open any text editor.
  10. Type in the following code:
    platform :ios, '5.0'
    
    pod 'Sparrow-Framework', '2.0.1'
  11. Save the file as Podfile in the recently copied barebone folder on the same level as the Xcode project file. If you are using TextEdit (OS X default text editor), make sure to save the file in the plain format which can be done by changing Format to Make Plain Text in the menu. Also disable Smart Quotes by navigating to TextEdit | Preferences….
  12. Open a terminal.
  13. Navigate to the copied barebone folder.
  14. Execute the pod install command in the terminal.
  15. Open PirateGame.xcworkspace with Xcode.
  16. Remove Sparrow.xcodeproj from the project by right-clicking on it and selecting Delete.
  17. Run the project in the iOS Simulator by hitting the play button. If there are any errors, try to change the Build Settings in the configuration by changing recursive to non-recursive in User Header Search Paths.
Time for action – using the barebone project as a template

What just happened?

We copied the barebone Sparrow template and used it as a template for our game. We renamed all project and scheme references.

We then needed to close Xcode, as CocoaPods will generate some files and we didn't want Xcode to interfere with the process.

In the next step, we had to define Podfile, which is the specification file for CocoaPods. This file tells CocoaPods which dependencies to fetch.

The specifications are written in Ruby, but they are easily understandable even to those who don't know the Ruby programming language.

The first statement sets the dependencies for the iOS platform. As mentioned earlier, CocoaPods can handle Mac OS and iOS dependencies even in the same project, so it makes sense for it to have a statement separating one from the other. As we are only targeting iOS, we don't need to worry about Mac OS dependencies and we leave that one out.

The second part of the Podfile in our example has all the dependencies we need in our project. As we only have one dependency—which is Sparrow—we only need to define that one.

A dependency is written in the following format:

pod 'name' 'version'

The repository with all dependencies and versions currently available can be found on GitHub at https://github.com/CocoaPods/Specs.

After our Podfile is written and saved, we need to get back to the terminal and let CocoaPods fetch our dependencies which is what pod install does. CocoaPods also generates a Pod folder which is where all dependencies are stored as well as an Xcode workspace.

From now on, instead of opening the project file, we need to open the workspace file as this is what CocoaPods updates and maintains.

If we were to open the project file and try to run the application, the application would fail to compile.

As the last step, we run our example. The indication that everything worked fine is when there are no errors while compiling the template and a red rectangle shows up on the screen.

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.
Sparrow iOS Game Framework Beginner's Guide
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