Ios 知道skspritenode已经完全超越了另一个skspritenode
我试图找出一个SKSpriteNode已经完全迭代了另一个Ios 知道skspritenode已经完全超越了另一个skspritenode,ios,swift,xcode,sprite-kit,skspritenode,Ios,Swift,Xcode,Sprite Kit,Skspritenode,我试图找出一个SKSpriteNode已经完全迭代了另一个SKSpriteNode这是我迄今为止提出的代码, if (node.frame.maxY == player.frame.minY) { player.physicsBody?.collisionBitMask = collisionTypes.vortex.rawValue } 我知道这很简单,但我在这里迷路了。设置两个对象的contactTestBitMask属性。然后在DIDBENG func中检测它们何时碰撞,然后在d
SKSpriteNode
这是我迄今为止提出的代码,
if (node.frame.maxY == player.frame.minY) {
player.physicsBody?.collisionBitMask = collisionTypes.vortex.rawValue
}
我知道这很简单,但我在这里迷路了。设置两个对象的contactTestBitMask属性。然后在DIDBENG func中检测它们何时碰撞,然后在didEnd func中检测它们何时停止碰撞
player.physicsBody?.contactTestBitMask = collisionTypes.bullet.rawValue
bullet.physicsBody?.contactTestBitMask = collisionTypes.player.rawValue
func didBegin(_ contact: SKPhysicsContact) {
//detect your collision and do what you need to do
//maybe set a bool to true if you have multiple collision types
}
func didEnd(_ contact: SKPhysicsContact) {
//check that the above collison is the one that ended
//run appropriate code for end collision
}
你是说在上面吗?还是完全通过了?完全通过了