Book Image

Learning Objective-C by Developing iPhone Games

By : Joseph D. Walters, Amy M. Booker
Book Image

Learning Objective-C by Developing iPhone Games

By: Joseph D. Walters, Amy M. Booker

Overview of this book

<p>The introduction of the Apple Store has empowered thousands, even millions of people to embrace software development. Using Objective-C and the Xcode IDE, you can produce awesome games and launch them on the Apple Store allowing you to make and sell games quickly and easily.</p> <p>From learning the basics of Objective-C to deploying to the App Store, you'll use this book to learn about game development in a matter-of-fact, helpful manner. Whether you're new to game development, or just want to learn how to leverage Apple's own tools to expand your skill set, you'll quickly move from a beginner to an expert.</p> <p>The book kicks off with the basics of game development, and you will take your first steps with using Xcode, the official Apple programming IDE, before moving on to the most important concepts involved in programming games using Objective-C. This book is a hands-on guide to developing the game of your dreams in no time for the Apple Store.</p>
Table of Contents (17 chapters)
Learning Objective-C by Developing iPhone Games
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
3
iPhone Game Development Basics – The Matching Game
Index

Setting up the gameplay environment


As we mentioned earlier in the chapter, the sprite kit is focused around creating sprite nodes. For each item in a sprite kit game, a node will be created for the type. Let's start with our background. In order to create a background image node, we will first need to create a SKSpriteNode, assign it to a variable, and tell it which image to use. A sprite node is considered to be a textured node but can be initialized with a texture, a named image as we are doing here, or just as a colored square. The code for sprite node creation is as follows:

SKSpriteNode *background = [SKSpriteNode
       spriteNodeWithImageNamed:@"background"];

There are currently seven different types of node classes associated with the SKNode class that each have their own set of properties, which are as follows:

  • SKSpriteNode: This class is for textured sprites for images

  • SKVideoNode: This class is for playing digital video

  • SKLabelNode: This class is a text node

  • SKShapeNode: This class...