xcode - IOS Swift: EXC_BAD_INSTRUCTION -
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) // 1. create physics body borders screen let borderbody = skphysicsbody(edgeloopfromrect: self.frame) // 2. set friction of physicsbody 0 borderbody.friction = 0 // 3. set physicsbody of scene borderbody self.physicsbody = borderbody physicsworld.gravity = cgvectormake(0, 0) let ball = childnodewithname(ballcategoryname) as! skspritenode ball.physicsbody!.applyimpulse(cgvectormake(10, -10)) } }
on line of code:
let ball = childnodewithname(ballcategoryname) skspritenode
i error:
"thread 1:exc_bad_instruction (code=exc_1386_invop, subcode=0x0)
why?
running xcode version 6.4 (6e35b)
try init ball :
let ball : skspritenode = childnodewithname(ballcategoryname) skspritenode
let me know if find issue.
thanks
Comments
Post a Comment