Posts

Post not yet marked as solved
1 Replies
920 Views
My APPUITests.xctest and APPTests.xctest files is empty. The words 'APPUITests.xctest' and 'APPTests.xctest' are red. I deleted them and recreated them in 'Targets'. But the new ones are still empty. What should I do? Thank you.
Posted Last updated
.
Post not yet marked as solved
10 Replies
2.3k Views
I wanna add a score when the character contacts with the 'coins' and game over when it contacts with the 'enemies'. But it doesn't work. I compiled the ...Category and <SKPhysicsContactDelegate> code in GameScene.h and these:- (instancetype)initWithSize:(CGSize)size { if (self = [super initWithSize:size]) { self.character = [SKSpriteNode spriteNodeWithImageNamed:@"character"]; self.character.position = CGPointMake(100, 100); [self addChild:self.character]; self.physicsWorld.gravity = CGVectorMake(0,0); self.physicsWorld.contactDelegate = self; } return self; }in .m above didMoveToView method. Can I use initWithSize in Xcode 8? And I do use these code in .m:character.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:character.size]; //1 character.physicsBody.dynamic = YES; //2 character.physicsBody.categoryBitMask = characterCategory; //3 character.physicsBody.contactTestBitMask = coinCategory | enemiesCategory;//4 character.physicsBody.collisionBitMask = 0; // 5I use them in "setPhysicsBody:(SKPhysicsBody *)physicsBody" method. And of couse I compiled the didBeginContact method. Did I miss anything? Please help me. Thank you very much.
Posted Last updated
.