Book Image

Learning iOS 8 Game Development Using Swift

By : Siddharth Shekar
Book Image

Learning iOS 8 Game Development Using Swift

By: Siddharth Shekar

Overview of this book

<p>Game development has been simplified with Apple's new programming language—Swift. If you're looking to start learning iOS development then you'll get everything you need - from&nbsp;the absolute basics such as the Xcode interface and takes you all the way to Swift programming.</p> <p>You will take a walk through the creation of 2D and 3D games followed by an introduction to SpriteKit and SceneKit. The book also looks at how game objects are placed in 3D scenes, how to use the graphics pipeline, and how objects are displayed on mobile screens. You will also delve into essential game concepts such as collision detection, animation, particle systems, and scene transitions. Finally, you will learn how to publish and distribute games to the iTunes store.</p>
Table of Contents (18 chapters)
Learning iOS 8 Game Development Using Swift
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 4. SpriteKit Basics

After an entire chapter of theory, we have finally reached the chapter where we will be creating a game. I am sure that this is a moment you have been waiting for and your fingers are aching to write some code and make a game.

In this chapter, you will create a small and basic game using SpriteKit. We will see how to create the main menu of the game, and you will learn how to transition from the main menu scene to the gameplay scene, where all of the gameplay code will be written.

In the gameplay scene, we will add sprites, such as the background and hero, first. We will then create a small physics engine to make the hero move around. Then, we will add in the enemies, and move them too. Next, we will make the hero and the enemies shoot at each other. We will detect collision between the hero's rockets and the enemies, and between the enemies' bullets and the hero. For each enemy the hero shoots, we will get one point, but if any of the enemies go past the left of...