Ios7 Sprite套件检测接触
我有四个精灵:球、物体、线和星星。 我还定义了以下类别:Ios7 Sprite套件检测接触,ios7,collision-detection,sprite-kit,Ios7,Collision Detection,Sprite Kit,我有四个精灵:球、物体、线和星星。 我还定义了以下类别: 静态constuint32\u t ballcegory=0x1您的代码中有一个输入错误:starsCsategory ball.physicsBody.contactTestBitMask = objectsCategory | starsCsategory; if( ( contact.bodyA.categoryBitMask & lineCategory ) == lineCategory || ( contac
静态constuint32\u t ballcegory=0x1您的代码中有一个输入错误:starsCsategory
ball.physicsBody.contactTestBitMask = objectsCategory | starsCsategory;
if( ( contact.bodyA.categoryBitMask & lineCategory ) == lineCategory || ( contact.bodyB.categoryBitMask & lineCategory ) == lineCategory ) {
score++;
scoreLabelNode.text = [NSString stringWithFormat:@"%ld", (long)score];
}
if( ( contact.bodyA.categoryBitMask & ballCategory ) == ballCategory || ( contact.bodyB.categoryBitMask & ballCategory ) == ballCategory ) {
[self gameOver];
}
if( ( contact.bodyA.categoryBitMask & starsCategory ) == starsCategory || ( contact.bodyB.categoryBitMask & starsCategory ) == starsCategory ) {
score = score + 100;
scoreLabelNode.text = [NSString stringWithFormat:@"%ld", (long)score];
}
ball.physicsBody.contactTestBitMask = objectsCategory | starsCsategory;