September 2018
Intermediate to advanced
434 pages
8h 47m
English
Create a new class, called Hero, and add the following code to it:
import SceneKit
class Hero: SCNNode {
var isGrounded = false
var monsterNode = SCNNode()
var jumpPlayer = SCNAnimationPlayer()
var runPlayer = SCNAnimationPlayer()
init(currentScene: GameSCNScene){
super.init()
self.create(currentScene: currentScene)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func create(currentScene: GameSCNScene){
}
} At the top of the create variables, which we will be needing later, we create a bool to check whether the character is grounded or not. Create a SCNNode to access the character node and create two SCNAnimationPlayer variables to access the player animations. ...
Read now
Unlock full access