Book Image

Getting Started with SpriteKit

By : Jorge Jordán
Book Image

Getting Started with SpriteKit

By: Jorge Jordán

Overview of this book

SpriteKit is Apple’s game engine to develop native iOS games. Strongly boosted by the Apple Inc., Cupertino, it has increased in popularity since its first release. This book shows you the solutions provided by SpriteKit to help you create any 2D game you can imagine and apply them to create animations that will highlight your existing apps. This book will give you the knowledge you need to apply SpriteKit to your existing apps or create your own games from scratch. Throughout the book, you will develop a complete game. The beautiful designs implemented in the game in this book will easily lead you to learn the basis of 2D game development, including creating and moving sprites, and adding them to a game scene. You will also discover how to apply advanced techniques such as collision detection, action execution, playing music, or running animations to give a more professional aspect to the game. You will finish your first game by learning how to add a main menu and a tutorial, as well as saving and loading data from and to the player’s device. Finally, you will find out how to apply some mobile games techniques such as accelerometer use or touch detection.
Table of Contents (13 chapters)
Getting Started with SpriteKit
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Index

A

  • accelerometer
    • using / Using the accelerometer
    • CMMotionManager class / The CMMotionManager class
    • device position, compensating / Compensating for the position of the device
  • actionForKey(_$) method / Handling actions
  • animations
    • creating, in SpriteKit / Creating animations in SpriteKit
  • Audacity
    • URL / Audacity
  • audio files
    • finding / How to find audio files
    • references / How to find audio files
  • audio resources
    • creating / Creating audio resources
    • voice memos / Voice memos
    • Audacity / Audacity
    • GarageBand / GarageBand
  • AVFoundation
    • about / AVFoundation

C

  • CMMotionManager class / The CMMotionManager class
  • collision management
    • about / Collision management
    • collisions / Understanding collisions
    • collisions, handling / Handling collisions
  • collisions
    • checking / 1-star challenge: check collisions accurately, Solution
  • collisions, animating
    • about / 2-star challenge: animate collisions
    • solution / Solution

D

  • data
    • loading / Loading and saving data
    • saving / Loading and saving data

E

  • editor
    • lights, creating with / Creating lights with the editor
  • emitter
    • properties / Creating an emitter with the editor

F

  • font makers
    • references / Font makers

G

  • game
    • ending / Ending the game
    • restarting / 3-star challenge: restarting a game
    • solution / Solution
    • shaders, adding to / Adding shaders to our game
  • game engines
    • defining / Game engines
  • game loop
    • about / The game loop
    • URL / The game loop
  • geometrical primitives
    • about / Geometrical primitives
  • GLES
    • about / Adding shaders to our game
  • Graphics Processing Unit (GPU)
    • about / Adding shaders to our game

H

  • hasActions() method / Handling actions

I

  • images
    • finding / How to find images
    • references / How to find images
  • InsideTheHat game
    • about / Your first game – InsideTheHat
    • background, adding / Adding a background
  • Integrated Development Environment (IDE)
    • about / Creating a new SpriteKit project

K

  • known property files
    • about / The property list files

L

  • labels
    • creating / Creating labels
    • aligning / Aligning labels
  • lights
    • turning on / Turning on the lights
    • properties / Turning on the lights
    • creating, with editor / Creating lights with the editor
    • creating programmatically / Programmatically creating lights
    • moving / 2-star challenge: moving lights
    • solution / Solution

M

  • main menu
    • creating / Creating a main menu
  • music
    • playing / Playing some music

N

  • nodes
    • about / The SKNode class
  • NSUserDefaults class
    • defining / The NSUserDefaults class

O

  • Open Graphics Library (OpenGL)
    • about / Adding shaders to our game
  • Open Graphics Library Embedded Systems (OpenGL ES)
    • about / Adding shaders to our game
  • optional chaining
    • URL / How the default project looks like
    • about / How the default project looks like

P

  • parallax effect
    • about / The parallax effect
    • update method / The update method and delta times
    • delta times / The update method and delta times
  • particle systems
    • creating / Creating particle systems
    • emitter, creating with editor / Creating an emitter with the editor
    • emitter, creating programmatically / Creating the emitter programmatically
  • position resetting, 1-star challenge
    • about / 1-star challenge: an easier way to reset position
    • solution / Solution
    • loops, creating / Creating loops
    • doors, installing to wall / Installing doors into the wall
  • properties, SKNode class
    • position property / The position property
    • frame property / The frame property
    • zPosition property / The zPosition property
    • hidden property / The hidden property
    • alpha property / An alpha property
    • children node / The children node
    • name / name
    • userInteractionEnabled / userInteractionEnabled
  • properties, SKScene class
    • scaleMode / scaleMode
    • anchorPoint / anchorPoint
    • size / size
    • backgroundColor / backgroundColor
  • puppet collision
    • defining / 2-star challenge: colliding puppets
    • solution / Solution

R

  • removeActionForKey(_$) method / Handling actions
  • removeAllActions() method / Handling actions
  • RGBA (Red, Blue, Green, and Alpha) color
    • about / backgroundColor
  • runAction(_$) method / Handling actions
  • runAction(_$, completion
    • ) method / Handling actions
  • runAction(_$, withKey$) method / Handling actions

S

  • scene graph
    • about / The SKNode class
  • scene hierarchy
    • about / The SKNode class
  • scenes
    • and transitions / Transitions and scenes
  • screen resolutions
    • working with / Working with screen resolutions
  • shader algorithm
    • variables / Adding shaders to our game
  • shaders
    • adding, to game / Adding shaders to our game
  • SKLabelNode class / Aligning labels
  • SKNode class
    • defining / The SKNode class
    • properties / The SKNode class properties
    • used, for organizing scene / Using SKNode to organize a scene
    • extending / Extending the SKNode class
    • new class, creating / Creating a new class
    • custom class behavior, handling / Handling the behavior of custom classes
  • SKScene class
    • defining / SKScene
    • game loop / The game loop
    • properties / The SKScene properties
  • SKShader
    • references / Adding shaders to our game
  • SKSpritenode and EnemyType variables
    • references / Creating a new class
  • SKSpriteNode class
    • URL / Our first SKSpriteNode class
    • defining / Our first SKSpriteNode class
  • SKTransition class
    • about / The SKTransition class
    • methods, defining / The SKTransition class
  • sound effects
    • reproducing / 2-star challenge: reproducing sound effects, Solution
  • SpriteKit
    • about / Game engines
    • animations, creating / Creating animations in SpriteKit
    • and UIKit, combining / Combining SpriteKit and UIKit
    • including, in app / Including SpriteKit in an app
  • SpriteKit class
    • URL / The SKNode class
  • SpriteKit project
    • creating / Creating a new SpriteKit project
    • running / Running the project for first time
    • default project, displaying / How the default project looks like

T

  • texture atlases
    • about / Creating animations in SpriteKit
  • third-party tools
    • using / Using third-party tools
    • audio resources, creating / Creating audio resources
    • font makers / Font makers
  • touchesBegan method / Handling touch events
  • touchesCancelled method / Handling touch events
  • touchesEnded method / Handling touch events
  • touchesMoved method / Handling touch events
  • touch events
    • handling / Handling touch events
    • actions, handling / Handling actions
    • wall, building / Building a wall
    • running, through doors / Running through the doors
  • transitions
    • and scenes / Transitions and scenes
  • tutorial
    • creating / Creating a tutorial
    • completing / 2-star challenge: completing the tutorial
    • solution / Solution
    • property list files / The property list files
  • tutorial steps
    • updating / Updating the tutorial steps

U

  • UIKit
    • and SpriteKit, combining / Combining SpriteKit and UIKit
    • including, into game / Including UIKit in a game
  • User Interface Kit (UIKit)
    • about / Combining SpriteKit and UIKit, Including UIKit in a game
    • URL / Including UIKit in a game

X

  • Xcode
    • URL / Creating a new SpriteKit project