Skip to main content
Top

2014 | Book

Learn Sprite Kit for iOS Game Development

insite
SEARCH

About this book

With Learn Sprite Kit for iOS Game Development, you'll discover how easy it is to create 2D games using the new Sprite Kit framework from Apple. You'll find how simple it is to create a scene, add animated sprites, incorporate edges, play sound effects, and create animated particles for special effects. You'll also use touch events to control your sprites, implement the built-in physics engine, handle sprite collisions and contacts, and much more.

To help you in learning how to use all these cool features of Sprite Kit, you'll follow along as we build a complete 2D game for iPhone. By the time you finish the book, you'll have made your own 2D game, and you'll have learned all you need to know to get started on your next masterpiece.

Table of Contents

Frontmatter
Chapter 1. Hello World
Abstract
■■■
Leland Long
Chapter 2. SKActions and SKTextures: Your First Animated Sprite
Abstract
The “Hello World” application was a good introduction to a few Sprite Kit fundamentals such as the SKScene, SKLabelNode, SKSpriteNode, and SKAction objects, but it was seriously lacking in functionality (unless your idea of a great game is to spawn 100 spinning spaceships faster than the next developer)!
Leland Long
Chapter 3. Sprite Movement Responding to User Inputs
Abstract
So far, once the game screen is presented (initially with a solid black background), an animated sprite appears on the screen when the user taps the screen. That’s all well and good, but you’ve only just begun. Now you’ll add some movement!
Leland Long
Chapter 4. Edges, Boundaries, and Ledges
Abstract
You can probably imagine the amount code work needed to add complicated sprites that interact with each other and with the game world you create. In this game, you’ll want basic physics principles like gravity to affect every character that you add to the game. You’ll also want your sprites to have some walls or ledges to run along. However, all of the coding required to handle all of these physics-based interactions is daunting. Luckily, Sprite Kit comes with a built-in physics world. Let’s start exploring this option with your sprite and its world.
Leland Long
Chapter 5. More Animated Sprites: “Enemies” and “Bonuses”
Abstract
So far, this game is a solo endeavor of running and jumping endlessly without any apparent objective. In the words of my little cousin, “It’s lame!” That’s just a wee bit pessimistic, but it is a fairly accurate assessment.
Leland Long
Chapter 6. Creating a Cast of Characters
Abstract
The solution to enemy spawning thus far has been to use the update method in the SKBGameScene class to create new sprites in a repeating loop until hitting a statically defined maximum. While this works fine for viewing immediate results when adding new enemy classes, it’s not an elegant or efficient solution in the long term. You need a way of introducing characters into play in such a way that you can easily change your mind without having to change the code, thereby forcing you to rebuild the project every time you add, remove, or modify your spawning ideas. In other words, you need a dynamic “cast of characters.”
Leland Long
Chapter 7. Points and Scoring
Abstract
A game needs a goal—something the player needs to obtain. In the case of this game, players play for points and the best score wins!
Leland Long
Chapter 8. Contacts and Collisions
Abstract
aa
Leland Long
Chapter 9. Add More Scenes and Levels
Abstract
Before you begin adding more levels to the game, you have some additional details to implement. For instance, you’ll want the player to be able to “die” more than once in the game without the game ending. You will have the game start with several player lives, so that when a nasty vermin bites the player, it can reappear a few seconds later, ready to tackle them again. After all, accidents happen and vermin are vicious and sewers are stinky, but your hero is resilient and will survive! Hopefully.
Leland Long
Chapter 10. Where to Go from Here
Abstract
You made it to the end of the book, and you’ve built an exciting game from scratch. Along the way, you gained an understanding of the Sprite Kit API and you implemented many of its features. You undoubtedly know a lot more now than when you started.
Leland Long
Backmatter
Metadata
Title
Learn Sprite Kit for iOS Game Development
Author
Leland Long
Copyright Year
2014
Publisher
Apress
Electronic ISBN
978-1-4302-6440-8
Print ISBN
978-1-4302-6439-2
DOI
https://doi.org/10.1007/978-1-4302-6440-8

Premium Partner