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 learned 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 as we will be using it exclusively in our demo game.
We will learn to use SpriteKit to power the mechanics of our game in the following ways:
- Animating our player, enemies, and power-ups
- Painting and moving side-scrolling environments
- Playing sounds and music
- Applying physics such as gravity and impulses for movement
- Handling 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 with classes, protocols, inheritance, and composition.
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 that 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 an experience 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 end up feeling confident in your ability to create games with Swift and bring them to market in the App Store.
Monetizing your work
Game development is a fun and rewarding process, even without compensation, but the potential exists to start a career, or side job, selling games on the App Store. Successfully promoting and marketing your game is an important task. I will outline your options and start you down the path to monetization.