2D Arcade Game Template

This page explains how the code is structured so far.

Microsoft Windows & Xbox UWP App code

Initially the template is written in C++/WinRT but doesn’t contain any DirectX code or game code as yet.

This code contains a basic Direct2D app which we will use later on.

Apple iOS and MacOS App code

Documentation of the SpriteKit is here.

There is a good tutorial on starting SpriteKit here. You can add images in your app – instructions are here.

Documentation on setting up an app for iOS and MacOS is via the apple developer documentation. To develop for iOS, you use UIKit and for MacOS, you use AppKit

Some useful tutorials:

The initial template that is given via default when you create a new project from SpriteKit. It contains default code to display some text and display some coloured spinning rectangles.

The code in AppDelegate.swift contains application code to initialise your app, specifies what it does when the app runs in the background when inactive, and what happens when the user ends the app.

The code in GameViewController.swift (or ViewController.swift) loads the game scene.

The main game code is in GameScene.swift and this is where all the game code will be written. It has a class GameScene which is inherited from SKScene (Sprite Kit Scene). It contains the functionality of our game. You can override functions using the override func keywords.

It contains a function override func update(_ currentTime: TimeInterval) which updates once per frame – it also keeps track of time via a built in game timer to make the game run smoothly.

The next step is to alter the game code in GameScene.swift to build our game. We can pretty much use the same game code for both the iOS and MacOS game.

Note: Gamescene.sks and Actions.sks are files that you can use to build your game without much code. A tutorial on using this is here.