Swift 3 Game Development - Second Edition
Copyright 2017 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: July 2015
Second edition: February 2017
Production reference: 1310117
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B32PB, UK.
ISBN 978-1-78712-775-3
www.packtpub.com
Credits
Author Stephen Haney | Copy Editor Safis Editing |
Reviewer Giordano Scalzo | Project Coordinator Ulhas Kambali |
Commissioning Editor Ashwin Nair | Proofreader Safis Editing |
Acquisition Editor Reshma Raman | Indexer Rekha Nair |
Content Development Editor Onkar Wani | Graphics Abhinash Sahu |
Technical Editor Rashil Shah | Production Coordinator Nilesh Mohite |
About the Author
Stephen Haney has written two books on iOS game development. He began his programming journey at the age of 8 years on a dusty, ancient laptop using BASIC. He has been fascinated with building software and games ever since. Now well versed in multiple languages, he enjoys programming as a creative outlet the most. He believes that indie game development is an art form-- an amazing combination of visual, auditory, and psychological challenges-rewarding to both the player and the creator.
He enjoyed writing this book and sincerely hopes that it directly furthers your career or hobby.
Thank you to my wonderful father, mother, and sister for their patience as I write and work, and also to my friends: Geoff, Robert, Justin, Jessie, Devin, Jason, Ben, Chris, Anna, and Shane, among others. I love you all!
About the Reviewer
Giordano Scalzo is a developer with 20 years of programming experience since the days of the ZX Spectrum.
He has worked in C++, Java, .NET, Ruby, Python, and in a ton of other languages he has forgotten the names of.After years of backend development, over the past five years, Giordano has done extensive development for iOS, releasing more than 20 apps that he wrote for clients and enterprise applications on his own.
Currently, he is a contractor in London where, through his company-Effective Code Ltd (http://effectivecode.co.uk)-he delivers code for iOS, aiming at quality and reliability.
In his spare time, when he is not crafting retro game clones for iOS, he writes and shares his thoughts on http://giordanoscalzo.com.
Id like to thank my better half, Valentina, who lovingly supports me in everything I do: without you, none of this would have been possible.Thanks to my bright future, Mattia and Luca, for giving me lots of smiles and hugs when I needed them.Finally, my gratitude goes to my mum and my dad, who encouraged my curiosity and supported me to follow my passions, which began one day when they bought me a ZX Spectrum.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Customer Feedback
Thank you for purchasing this Packt book. We take our commitment to improving our content and products to meet your needs seriously-that's why your feedback is so valuable. Whatever your feelings about your purchase, please consider leaving a review on this book's Amazon page. Not only will this help us, more importantly it will also help others in the community to make an informed decision about the resources that they invest in to learn.
You can also review for us on a regular basis by joining our reviewers' club. If you're interested in joining, or would like to learn more about the benefits we offer, please contact us : customerreviews@packtpub.com.
Preface
There has never been a better time to be a game developer. The App Store provides a unique opportunity to distribute your ideas to a massive audience. Also, now Swift 3 has arrived! Apple's Swift language is maturing and hitting its stride in version 3. Whether you are new to game development or looking to add to your expertise, I think you will enjoy making games with Swift.
With this book, my goal is to share a fundamental knowledge of Swift and SpriteKit. We will work through a complete example game so that you learn every step of the Swift development process. Once you finish this text, you will be comfortable designing and publishing your own game ideas to the App Store from start to finish.
Please reach out to me for any questions and share your game creations:
E-mail: stephen@joyfulgames.io
Twitter: @sdothaney
The first chapter explores some of Swifts best features. Lets get started!
What this book covers
, Designing Games with Swift , introduces you to the best features of Swift, outlines what is new in Swift 3, helps you set up your development environment, and launches your first SpriteKit project.
, Sprites, Camera, Action! , teaches you the basics of drawing and animating with Swift. You will draw sprites, import textures into your project, and center the camera on the main character.
, Mix in the Physics , covers the physics simulation fundamentals: physics bodies, impulses, forces, gravity, collisions, and more.