I'm trying to self to add SKSpriteNodes to the view in a function, but Xcode will not allow me to do so. It gives me the error "Use of unresolved identifier 'self'"
func indicate() {
if test == 0 {
var large = ((CGFloat(largest)*54) - 29) - selectedNode.position.x
var small = selectedNode.position.x - ((CGFloat(smallest)*54) - 29)
indicatorRight.position = CGPointMake(selectedNode.position.x + large, selectedNode.position.y)
indicatorRight.userInteractionEnabled = true
indicatorRight.zPosition = 0.5
indicatorLeft.position = CGPointMake(selectedNode.position.x - small, selectedNode.position.y)
indicatorLeft.userInteractionEnabled = true
indicatorLeft.zPosition = 0.5
println(indicatorLeft.position)
// println(smallest)
self.addChild(indicatorRight)
self.addChild(indicatorLeft)
}
}
Make sure the method is presented in the Class open and closing braces
class A {
// You need to define a method here
}
// You might have declared it here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With