Book Image

Learning iOS 8 Game Development Using Swift

By : Siddharth Shekar
Book Image

Learning iOS 8 Game Development Using Swift

By: Siddharth Shekar

Overview of this book

<p>Game development has been simplified with Apple's new programming language—Swift. If you're looking to start learning iOS development then you'll get everything you need - from&nbsp;the absolute basics such as the Xcode interface and takes you all the way to Swift programming.</p> <p>You will take a walk through the creation of 2D and 3D games followed by an introduction to SpriteKit and SceneKit. The book also looks at how game objects are placed in 3D scenes, how to use the graphics pipeline, and how objects are displayed on mobile screens. You will also delve into essential game concepts such as collision detection, animation, particle systems, and scene transitions. Finally, you will learn how to publish and distribute games to the iTunes store.</p>
Table of Contents (18 chapters)
Learning iOS 8 Game Development Using Swift
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Sprite sheet animation


Until now, what we were doing was using a single file for the player, enemy, rocket, and bullet. Every time we create a new rocket, the game goes and gets the memory, and finds and retrieves the image. The process is repeated every time a bullet is created. This is okay for a simple game such as ours, but later, when we start creating more complex games with a lot more enemies and bullet types, the process will become very taxing on the device, and the performance of the game will be affected.

To solve this problem, sprite sheets are used. A sprite sheet contains all the images that we will use in the game in a single file, instead of 10 images sitting at 10 different memory locations. The sprite sheet image file will also be accompanied by a data file, which will contain the location and size of each of the images located in the sprite sheet. At the start of the game, the sprite sheet image and data file are loaded into the cache once. Then, every time the rocket or...