Creating subclasses for our Platformer game
With the theoretical understanding of nodes, one wonders how this concept is helpful in developing a game. To understand the development of a game using the concept of Nodes, we now go ahead with writing and executing code for our Platformer game.
Create the subclasses of different nodes in Xcode, following the given steps:
- From the main menu, select New File | Swift | Save As | NodeMenuScene.swift:
Make sure Platformer is ticked as the target. Now Create and Open and make the
NodeMenuScene
class by subclassingSKScene
. - Following the previous same steps as, make
CropScene
,ShapeScene
,ParticleScene
,LightScene
, andVideoNodeScene
files, respectively. - Open the
GameViewController.swift
file and replace theviewDidLoad
function by typing out the following code:override func viewDidLoad() { super.viewDidLoad() let menuscene = NodeMenuScene() let skview = view as SKView skview.showsFPS = true skview.showsNodeCount...