September 2018
Intermediate to advanced
434 pages
8h 47m
English
Let's see how to add basic game objects, such as a regular sprite and text, to the scene.
At the top of the Scene.swift class, add crosshair of type SKSpriteNode and scoreText of type SKLabelNode called crosshair and scoreText as follows:
import SpriteKit
import ARKit
class Scene: SKScene {
var crosshair: SKSpriteNode!
let scoreText = SKLabelNode(text: "00")Also create a new ARSKView called sceneView, which will return the current view as ARSKView. This is because we need to access the current view often:
var sceneView: ARSKView {
return view as! ARSKView
}The crosshair image is provided in the assets for the chapter. Copy and include it in the current project's assets, as follows:
In the viewDidLoad function, add the following ...
Read now
Unlock full access