Book Image

Game Development with Swift

By : Stephen Haney
Book Image

Game Development with Swift

By: Stephen Haney

Overview of this book

Table of Contents (18 chapters)
Game Development with Swift
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

What you will learn in this book


By the end of this book, you will be capable of creating and publishing your own iOS games. You will know how to combine the techniques we learn to create your own style of game and you will be well prepared to dive into more advanced topics with a solid foundation in 2D game design.

Embracing SpriteKit

SpriteKit is Apple's 2D game development framework and your main tool for iOS game design. SpriteKit will handle the mechanics of our graphics rendering, physics, and sound playback. As far as game development frameworks go, SpriteKit is a terrific choice. It is built and supported by Apple and thus integrates perfectly with Xcode and iOS. You will learn to be highly proficient with SpriteKit – we will use it exclusively in our demo game.

We will learn to use SpriteKit to power the mechanics of our game:

  • Animate our player, enemies, and power-ups

  • Paint and move side scrolling environments

  • Play sounds and music

  • Apply physics-like gravity and impulses for movement

  • Handle collisions between game objects

Reacting to player input

The control schemes in mobile games must be inventive. Mobile hardware forces us to simulate traditional controller inputs, such as directional pads and multiple buttons on the screen. This takes up valuable visible area and provides less precision and feedback than with physical devices. Many games operate with only a single input method; a single tap anywhere on the screen. We will learn how to make the best of mobile input and explore new forms of control by sensing device motion and tilt.

Structuring your game code

It is important to write well-structured code that is easy to re-use and modify as your game design inevitably changes. You will often find mechanical improvements as you develop and test your games and you will thank yourself for a clean working environment. Though there are many ways to approach this topic, we will explore some best practices to build an organized system.

Building UI/menus/levels

We will learn to switch between scenes in our game with a menu screen. We will cover the basics of user experience design and menu layout as we build our demo game.

Integrating with Game Center

Game Center is Apple's built in social gaming network. Your game can tie into Game Center to store and share high scores and achievements. We will learn how to register for Game Center, tie it into our code, and create a fun achievement system.

Maximizing fun

If you are like me, you will have dozens of ideas for games floating around your head. Ideas come easily but designing fun gameplay is difficult! It is common to find your ideas need gameplay enhancements once you see your design in action. We will look at how to avoid dead-ends and see your project through to the finish line. Plus, I will share my tips and tricks to ensure your game will bring joy to your players.

Crossing the finish line

Creating a game is a memory you will treasure. Sharing your hard work will only sweeten the satisfaction. Once our game is polished and ready for public consumption, we will navigate the App Store submission process together. You will finish feeling confident in your ability to create games with Swift and bring them to market in the App Store.