Can someone please help me understand the difference between sceneDidLoad and didMove(to view:) in a GameScene? I realize that didMove(to view:) is called once the scene is presented. While sceneDidLoad is called once the scene is initialized. So its logical order is sceneDidLoad first, then didMove(to view:) later (right?)
With that said, I am trying to create a bouncing ball using the following:
let borderBody = SKPhysicsBody(edgeLoopFrom: self.frame)
self.physicsBody = borderBody
physicsWorld.gravity = CGVector(dx: 0.0, dy: 0.0)
let testBall = SKShapeNode(circleOfRadius: 20)
self.addChild(testBall)
testBall.physicsBody = SKPhysicsBody(circleOfRadius:
testBall.frame.size.width/2)
testBall.physicsBody!.restitution = 1.0
testBall.physicsBody!.friction = 0.0
testBall.physicsBody!.angularDamping = 0.0
testBall.physicsBody!.linearDamping = 0.0
testBall.physicsBody!.applyImpulse(CGVector(dx: 10.0, dy: 10.0))
By overriding either sceneDidLoad OR didMove, I get the same intended result. I fail to understand which is the 'smarter' or best practice method and why?
Thanks!
C