when I type this into xcode(6)
let ball = childNodeWithName(BallCategoryName) as! SKSpriteNode
I get this Error Message when I try to run it
Thread 1:EXC_BAD_INTRSUCTION (code=EXC_1386_INVOP, subcode=0x0)
here is the full lump of code
import SpriteKit
let BallCategoryName = "ball"
let PaddleCategoryName = "paddle"
let BlockCategoryName = "block"
let BlockNodeCategoryName = "blockNode"
class GameScene: SKScene {
override func didMoveToView(view: SKView) {
super.didMoveToView(view)
let borderBody = SKPhysicsBody(edgeLoopFromRect: self.frame)
borderBody.friction = 0
self.physicsBody = borderBody
physicsWorld.gravity = CGVectorMake(0, 0)
let ball = childNodeWithName (BallCategoryName) as! SKSpriteNode
ball.physicsBody!.applyImpulse(CGVectorMake(10, -10))
Thanks a lot, I am using swift in xcode 6 by the way, I am only new to this so It may be something really obvious to anyone else!
William Gregory