Swift Playgrounds is Apple’s entry into Swift. It’s designed to teach people, primarily school-age people, how to write code that can be used to make apps for the AppStore. It’s a brilliant plan – teach young people how to make apps for iOS then when they get older they’ll make apps for iOS.

GameDEV With Swift Playgrounds

In general, Swift Playgrounds is not really designed for game development. I think this is a mistake from Apple and I hope they rectify it with future updates to Swift Playgrounds. However, that hasn’t stopped me from trying to make it work.

I’ve built a few smaller games using Swift Playgrounds. I’ve even shown that it’s possible to convert a Swift Playgrounds project over to an Xcode project should you want more functionality later on. It should be easier though, Apple, if you’re listening.

Rockets Are Fun Part 1

So that brings me to my next project. Perhaps my most ambitious Swift Playgrounds project so far. A physics-based rocket game. I’m still working out what the gameplay will look like, but I have started sharing the build with my audience on YouTube.

In this first part of a multipart series on YouTube, I cover the initial setup of the Swift Playgrounds project, get the game’s UI roughed out, and start working on the propulsion system for the rocket in the game.

I’m pretty impressed with the propulsion system myself. I use a three-zoned system on the screen for the user to tap. If they tap to the right or left of the ship it will rotate the ship in that direction (without forward thrust), then if they tap within those two zones the ship will be pushed forward in the direction it’s facing.

It’s simple, yet fun.

To give the player some visual feedback I used two different mechanisms. The first was to simply spawn an expelled fuel cell in the color of the respective action that the player took. I also, using the “spinnyNode” from Apple’s SpriteKit template file, give the player some feedback as to which action they triggered.

I do have a lot of refinement to do here still, but I’m happy with this first pass and can’t wait to get into the refinement stage to really see it come to life.

Next time I’ll be adding the fuel resource that the player will have to manage to navigate the ship around the world and showcasing an (in my opinion) unique way to present this data to the player.

Follow my creative adventures…