O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learn Sprite Kit for iOS Game Development

Book Description


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

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Author
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Introduction
  11. Chapter 1: Hello World
    1. We Love Games
    2. Tradition
    3. Setup
    4. Summary
  12. Chapter 2: SKActions and SKTextures: Your First Animated Sprite
    1. Humble Beginnings
    2. Removing Unnecessary Tidbits
    3. Device Orientation
    4. Slight View Controller Changes
    5. More Unneeded Template Text
    6. Images Available for Download
    7. Background Color
    8. The Splash Screen
    9. Anchor Points
    10. Back to the Splash Screen
    11. Moving Between Scenes
    12. Creating a New Scene
    13. Animated Transitions Using SKActions
    14. Grouping Multiple Actions
    15. Animation Frames Using SKTextures
    16. Summary
  13. Chapter 3: Sprite Movement Responding to User Inputs
    1. Run Away!
    2. Code Reorganization
    3. New Class for the Player
    4. Replacing Static Values
    5. New Class for Your Textures
    6. Adding Textures
    7. Changing Direction
    8. Skidding to a Stop
    9. Summary
  14. Chapter 4: Edges, Boundaries, and Ledges
    1. Physics
    2. Properties of a Physics Body
    3. Adding a Backdrop
    4. Contacts and Collisions
    5. Adding a Brick Base
    6. Determining Contact with an Edge
    7. Handling Sprite Wrapping
    8. Jumping
    9. Ledges and Joints
    10. Summary
  15. Chapter 5: More Animated Sprites: “Enemies” and “Bonuses”
    1. The Opposition
    2. Optimizing Texture Generation
    3. Enemy “Ratz” Class
    4. Timing
    5. Wrapping
    6. The Update Method
    7. Collisions
    8. Bonus Coins
    9. Enemy and Coin Collisions
    10. Summary
  16. Chapter 6: Creating a Cast of Characters
    1. Static vs. Dynamic Characters
    2. File Format
    3. XML Format
    4. Loading the File
    5. Parsing the Data
    6. Implementing a New Spawning Process
    7. Summary
  17. Chapter 7: Points and Scoring
    1. What’s the Point?
    2. Score Display
    3. SKLabelNode
    4. Custom Font Textures
    5. Status Bar = Off
    6. A Different Kind of Score
    7. Playing Sound Files
    8. CAF Audio Format
    9. Player Spawn Sound Effect
    10. Player Running Sound Effect
    11. Player Jumping Sound Effect
    12. Player Skidding Sound Effect
    13. Enemy Spawn Sound Effect
    14. Coin Spawn Sound Effect
    15. Summary
  18. Chapter 8: Contacts and Collisions
    1. Didn’t You Cover this Already?
    2. Contacts vs. Collisions
    3. Grates
    4. Pipes
    5. Enemies that Occasionally Get Stuck
    6. Setting the Player’s Starting Location
    7. Collecting Coins
    8. Coin-Collection Sound Effect
    9. Coin Collection Point Display
    10. Particle Effects
    11. Coin Contact from Below the Ledges
    12. Ratz Contact from Below the Ledges
    13. Intersection Not Sensitive Enough
    14. Base Runners
    15. Player Kicking Enemies
    16. Ratz Collection Sound Effect
    17. Ratz Collection Point Display
    18. Kicked Off
    19. Into the River
    20. Enemies Kill Player
    21. Player Death Sound Effect
    22. Player Falls Off Ledge
    23. Player in the Water
    24. Summary
  19. Chapter 9: Add More Scenes and Levels
    1. Multiple Player Lives
    2. Adding a Visual Life Meter
    3. Game Over
    4. High Score
    5. Level-Completion Test
    6. Level-Completion Effects
    7. Unending Levels
    8. A New Enemy Type
    9. Two Hits Instead of One
    10. Levels Three and Four
    11. Player Instructions
    12. Summary
  20. Chapter 10: Where to Go from Here
    1. Going Forward with Sprite Kit
    2. Making the Game Better
    3. Resources
    4. Farewell
  21. Index