2017-02-10 52 views
1

當我的兩個SKSpriteNodes的觸摸didBeginContact功能不叫不叫:didBeginContact當接觸時

func didBegin(_ contact: SKPhysicsContact) { 
    let bodyA = contact.bodyA 
    let bodyB = contact.bodyB 

    print("Called") 

    if bodyA.categoryBitMask == 1 && bodyB.categoryBitMask == 2 || bodyA.categoryBitMask == 2 && bodyB.categoryBitMask == 1{ 

    //End 
     print("contact") 
     _ = GameScene4(fileNamed: "GameScene4.sks") 
+0

您是從SKPhysicsContactDelegate實現/繼承的嗎? –

+0

是的,我有@MadhupSinghYadav – Euan

回答

0

如果您正在使用Xcode8.0 Swift3.0你應該使用這個。

func didBegin(_ contact: SKPhysicsContact) {} 
+0

它仍然沒有被調用 – Euan