Getting Started with SpriteKit
eBook - ePub

Getting Started with SpriteKit

  1. 226 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Getting Started with SpriteKit

Book details
Book preview
Table of contents
Citations

About This Book

Develop fun and exciting games and create amazing animations for your existing apps with SpriteKit, Apple's 2D game development framework

About This Book

  • Learn the key concepts of game development in iOS
  • Take advantage of SpriteKit to create your own games and improve your apps
  • Follow the step-by-step chapters to create a complete product ready to submit to the App Store

Who This Book Is For

Getting Started with SpriteKit is for beginner-level iOS developers who want to add an extra edge to their apps and create amazing games using SpriteKit. It doesn't matter whether you have experience in iOS development or not as this book will show you the swift tricks you can use to create games.

What You Will Learn

  • Create and configure a SpriteKit project from scratch
  • Load and manage the basic elements of games such as sprites, labels, and geometrical primitives
  • Handle touch events, detect collisions, and play sound audio files
  • Create complex elements, animate sprites, and run the parallax effect
  • Complete your games with key components such as a main menu, transitions between scenes, a tutorial, and the ability to load and save data
  • Increase the efficiency of your device using the accelerometer or by adding shaders, lights, and shadows
  • Gain complementary techniques such as creating or finding audio resources, applying SpriteKit to apps, or using third-party tools

In Detail

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.

Style and approach

Written in an informal way with plenty of illustrative screenshots, this easy-to-follow and practical guide will help you get the most from SpriteKit. The main part of the book provides step-by-step instructions to develop of a complete product, while the last chapters give you some complementary techniques than can be used in mobile 2D game development.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Getting Started with SpriteKit by Jorge Jordan in PDF and/or ePUB format, as well as other popular books in Computer Science & Operating Systems. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781785887338
Edition
1

Getting Started with SpriteKit


Table of Contents

Getting Started with SpriteKit
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. The First Step toward SpriteKit
Game engines
Creating a new SpriteKit project
Running the project for first time
How the default project looks like
The SKNode class
The SKNode class properties
The position property
The frame property
The zPosition property
The hidden property
An alpha property
The children node
name
userInteractionEnabled
Using SKNode to organize a scene
SKScene
The game loop
The SKScene properties
scaleMode
anchorPoint
size
backgroundColor
Your first game – InsideTheHat
Our first SKSpriteNode class
Adding a background
Working with screen resolutions
Summary
2. What Makes a Game a Game?
Handling touch events
Handling actions
Building a wall
Running through the doors
1-star challenge: an easier way to reset position
Solution
Creating loops
Installing doors into the wall
Collision management
Understanding collisions
Handling collisions
1-star challenge: check collisions accurately
Solution
Creating labels
Aligning labels
Playing some music
AVFoundation
2-star challenge: reproducing sound effects
Solution
Summary
3. Taking Games One Step Further
Extending the SKNode class
Creating a new class
Handling the behavior of custom classes
2-star challenge: colliding puppets
Solution
The parallax effect
The update method and delta times
Creating animations in SpriteKit
2-star challenge: animate collisions
Solution
Geometrical primitives
Summary
4. From Basic to Professional Games
Ending the game
3-star challenge: restarting a game
Solution
Creating a main menu
Transitions and scenes
The SKTransition class
Creating a tutorial
Updating the tutorial steps
Loading and saving data
The NSUserDefaults class
2-star challenge: completing the tutorial
Solution
The property list files
Summary
5. Utilizing the Hardware and Graphics Processor
Using the accelerometer
The CMMotionManager class
Compensating for the position of the device
Adding shaders to our game
Turning on the lights
Creating lights with the editor
Programmatically creating lights
2-star challenge: moving lights
Solution
Summary
6. Auxiliary Techniques
Creating particle systems
Creating an emitter with the editor
Creating the emitter programmatically
Combining SpriteKit and UIKit
Including UIKit in a game
Including SpriteKit in an app
Using third-party tools
Creating audio resources
Voice memos
Audacity
GarageBand
Font makers
How to find audio files
How to find images
Summary
Index

Getting Started with SpriteKit

Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2016
Production reference: 1200116
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-733-8
www.packtpub.com

Credits

Author
Jorge JordĂĄn
Reviewer
Andrew Kenady
Commissioning Editor
Amarabha Banerjee
Acquisition Editor
Prachi Bisht
Content Development Editor
Arshiya Ayaz Umer
Technical Editor
Vishal Mewada
Copy Editor
Vedangi Narvekar
Project Coordinator
Shipra Chawhan
Proofreader
Safis Editing
Indexer
Priya Sane
Graphics
Kirk D'Penha
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade

About the Author

Jorge JordĂĄn is an iOS indie developer who's passionate about how things work since his childhood. This is the reason why he graduated in computer science and became a Java developer. After buying his first iPhone, he became deeply interested in its technology and spent his spare time learning how to develop apps for Apple's smartphones.
Over time, he founded www.insaneplatypusgames.com, where he tries to make his dreams and games come true. He is also a member of the tutorial team at www.raywenderlich.com.
Also, he has worked on a book titled Cocos2d Game Development Blueprints, Packt Publishing.
In his free time, he loves to play video games, play bass guitar, and watch TV series.
You can follow him on Twitter; his Twitter handle is @jjordanarenas.

About the Reviewer

Andrew Kenady is a game engineer from Kentucky. He holds a bachelor's degree in computer science from Western Kentucky University and has worked professionally in the games industry since his graduation in 2013. His published titles span multiple genres and platforms and include Battlepillars and Draw a Stickman: EPIC 2. He is currently working for NC2 Media, a Tennessee-based tech company, on new and promising confidential products for the mobile games sector.
In addition to working on this publication, Andrew has worked in...

Table of contents

  1. Getting Started with SpriteKit