Create a Simple IOS Game

Vatsal Vora
2 min readJul 8, 2020

I recently started a project to Empower people to lead successful lives and careers through Technical Skills. I want to give back to the community by teaching Technical Skills. This walkthrough is about creating a simple IOS game. The fact that you can create a simple IOS game in 30 minutes and a snippet of code is amazing. It is inspiring to see that you can create a program that runs on your phone in a short amount of time.

Part 1: Initial Setup + Background Image +Music

Youtube Link Github Link

  1. Create a new project with Xcode. Select the Game Template with SpriteKit.
  2. Import the assets (Background Image Files + Music File).
  3. Initialize the SKSpriteNode for the Background Image.
  4. Initialize the SKAudioNode for the Background Music.

Import Assets

  1. Import App Icon into Assets Folder.
  2. Import Background Image as an image set into the Assets Folder.
  3. Import Background Music file into main Project folder. Make sure to include the Music file in the resource bundle.

Background Image

Set the Bounds on the Game Scene

Initialize the SKSpriteNode for the Background Image

Make sure to add a zPosition so that the background image will show up under the rest of the Game Nodes

Background Music

Part 2: Game Characters + Movement

Youtube Link Github Link

  1. Add Image Assets for Game Characters
  2. Add Game Characters to Scene
  3. Add Player Character Movement
  4. Add Random Movement for Game Character

Import Assets

  1. Import Butterfly Image for player as an image set into the Assets Folder
  2. Import Butterfly Image for the game character as an image set into the Assets Folder

Add Game Characters to Scene

Add Player Character Movement

Add Game Character Random Movement

Part 3: Game Scoring System

Youtube Link Github Link

  1. Add Labels for Game Score and Time
  2. Add Game Logic to Calculate and Display Score
  3. Update Time Label with Elapsed Time

Add Labels for Game Score and Time

Add Game Logic to Calculate and Display Score

Use the Distance Formula to check if the Game Characters are close enough to each other. Update Score if the Characters are in the set radius.

Update Time Label with Elapsed Time

--

--

Vatsal Vora
Vatsal Vora

Written by Vatsal Vora

Hi! I am a Software Engineer who is really interested in Data Engineering and Cloud Computing!

No responses yet