0
我想向我的SpriteKit場景添加一個轉換,但它不起作用。我的第二個場景叫做「myScene」。這是我的代碼:SpriteKit轉換不起作用
func didBeginContact(contact: SKPhysicsContact) {
let collision:UInt32 = (contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask)
if collision == (playerCategory | crateCategory) {
NSLog("Game Over")
self.scene?.view?.paused = true
var myscene = myScene(size: self.size)
var transition = SKTransition.doorsCloseHorizontalWithDuration(0.5)
myscene.scaleMode = SKSceneScaleMode.AspectFill
self.scene!.view?.presentScene(myscene, transition: transition)
}
if (contact.bodyA.categoryBitMask == bubbleCategory) {
let node = contact.bodyB.node
//Other remove routine
node?.removeAllActions()
node?.removeFromParent()
} else if (contact.bodyB.categoryBitMask == bubbleCategory) {
let node = contact.bodyB.node
//Other remove routine
node?.removeAllActions()
node?.removeFromParent()
}
}
這裏有什麼問題?
評論不適合廣泛的討論;這個對話已經[轉移到聊天](http://chat.stackoverflow.com/rooms/82223/discussion-on-answer-by-the-codecomposer-spritekit-transition-wont-work)。 – Taryn