Beginning Swift Games Development for iOS

Book description

Game apps are one of the most popular categories in the Apple iTunes App Store. Well, the introduction of the new Swift programming language will make game development even more appealing and easier to existing and future iOS app developers. In response, James Goodwill and Apress introduce you to this book, Beginning Swift Games Development for iOS. In this book, you'll learn the fundamental elements of the new Swift language as applied to game development for iOS.

In part 1, you'll start with a basic 2D game idea and build the game throughout the book introducing each SpriteKit topic as we add new functionality to the game. By the end of the book, you'll have experience with all the important SpriteKit topics and have a fully functional game as a result. In part 2 of this book, you'll learn 3D game development using Apple's SceneKit framework and the Swift programming language. And, you'll follow the same pattern we used for part 1.

After reading and using this book, you'll have the skills and the code to build your first 2D and then 3D game app that you can run on any iOS enabled device and perhaps sell in the Apple iTunes App Store.

Table of contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Authors
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Introduction
  11. Part I: Swift and Sprite Kit
    1. Chapter 1: Setting Up Your Game Scene and Adding Your First Sprites
      1. What You Need to Know
      2. What You Need to Have
      3. SuperSpaceMan
      4. Creating a Swift Sprite Kit Project
      5. Starting from Scratch
        1. The GameViewController Class
        2. The GameScene Class
      6. Adding a Background and Player Sprite
      7. Summary
    2. Chapter 2: Sprite Kit Scenes and SKNode Positioning
      1. What Is an SKScene?
        1. The SKScene Rendering Loop
        2. Building the Scene’s Node Tree
      2. Looking at SKSpriteNode Coordinates and Anchor Points
        1. Coordinates
        2. Anchor Points
      3. Summary
    3. Chapter 3: Adding Physics and Collision Detection to Your Game
      1. What Is an SKPhysicsBody?
      2. Adding Physics to Your Game World
      3. Applying Forces to SKPhysicsBody
      4. Adding Collision Detection to Your SKNode
        1. Adding a Node to Collide Into
        2. Adding Collision Detection
        3. Removing the Orb When You Receive a Contact Message
      5. Summary
    4. Chapter 4: Adding Scene Scrolling and Game Control
      1. Reorganizing the GameScene
      2. Adding More Orbs to the Scene
      3. Scrolling the Scene
      4. Controlling Player Movement with the Accelerometer
      5. Summary
    5. Chapter 5: Adding Actions and Animations
      1. Refactoring the Orb Node Layout One Last Time
      2. Sprite Kit Actions
        1. Using Actions to Move Nodes in the Scene
        2. Using SKActions to Animate Sprites
      3. Adding Some Additional Bling to the GameScene
      4. Summary
    6. Chapter 6: Adding Particle Effects to Your Game with Emitter Nodes
      1. What Are Emitters?
        1. Using Particle Emitter Templates
        2. Creating a Particle Emitter
      2. Adding an Exhaust Trail to the Player
      3. Summary
    7. Chapter 7: Adding Points and Sound
      1. What Are SKLabelNodes?
        1. Changing the Horizontal Alignment of the Label Node
        2. Changing the Vertical Alignment of the Label Node
        3. Adding Scoring to the Game
        4. Adding an Impulse Counter to the Game
      2. Adding Simple Sounds to the Game
      3. Summary
    8. Chapter 8: Transitioning Between Scenes
      1. Transitioning Between Scenes Using SKTransitions
        1. Pausing Scenes During a Transition
        2. Detecting When a New Scene Is Presented
      2. Adding a New Scene to SuperSpaceMan
        1. Ending the Game
      3. Summary
    9. Chapter 9: Sprite Kit Best Practices
      1. Creating Your Own Nodes Through Subclassing
      2. Reusing Textures
      3. Externalizing Your Game Data
      4. Keeping Your Node Tree Pruned
      5. Summary
  12. Part II: Swift and Scene Kit
    1. Chapter 10: Creating Your First Scene Kit Project
      1. Scene Kit Primer
        1. Scene Kit Animation
        2. What You Need to Know
      2. Creating the Scene Kit Project
      3. Wiring Up and Building a Scene
      4. SuperSpaceMan3D
        1. Project Resources
        2. Building the Scene
      5. Summary
    2. Chapter 11: Building the Scene
      1. Scene Graph
      2. Scene Kit Editor
        1. Render Cycle
      3. Scene Kit’s Built-in Model Classes
        1. SCNGeometry Objects
      4. Adding Obstacles
      5. Using SCNText
        1. Starting Screen
      6. Summary
    3. Chapter 12: Lighting, Camera, and Material Effects in Scene Kit
      1. Lighting Up the Scene
      2. Materials
        1. Appling Materials to Your Obstacles
        2. Adding Textures to Collada Files
        3. Scene Kit Camera Usage
      3. Summary
    4. Chapter 13: Animating Your Models
      1. Refactoring the Project
      2. Starting Animations
        1. PyramidNode
        2. GlobeNode
        3. TubeNode
        4. BoxNode
      3. More Animations
      4. Summary
    5. Chapter 14: Hit Testing and Collision Detection
      1. GameView: Moving the Hero
        1. Writing the Callback Delegate Function
        2. Moving the Camera
      2. CoreMotion Framework Introduction
      3. Enemy Node
      4. Collision Detection
      5. Summary
    6. Chapter 15: Using Sprite Kit with a Scene Kit Scene
      1. Sprite Kit Integration
      2. Hooking Up the Controller to the Overlay
      3. “Game Over” Screen
      4. Bonus Section
      5. Summary
    7. Chapter 16: Advanced Topics and Tips
      1. Normal Mapping
      2. Vectors and Various Math Operations
      3. Tips
      4. Summary
    8. Appendix A: The Swift Programming Language
      1. Variables and Constants
      2. Flow of Control
        1. if
        2. switch
        3. for Loops
        4. while Loops
      3. Functions
        1. Variadic Parameters
        2. Tuples
        3. Nested Functions
        4. Functions Returning Functions
        5. Passing Functions As Parameters
        6. inout Parameters
      4. Closures
      5. Classes
        1. Extending Classes
        2. Computed Properties
      6. Structures
      7. Enumerations
      8. Protocols
      9. Extensions
      10. Generics
  13. Index

Product information

  • Title: Beginning Swift Games Development for iOS
  • Author(s): James Goodwill, Wesley Matlock
  • Release date: March 2015
  • Publisher(s): Apress
  • ISBN: 9781484204009