Reputation: 223
When i try to add:
self.physicsWorld.contactDelegate = self;
to the code of my main scene i get the following error:
'Assigning to 'id' from incompatible type 'MGLCreateMainGameScene *const_strong'
How can i fix this? This is what i have:
-(void)createMainGameScene
{
self.currentBackground = [MGLBackground generateNewBackground];
self.scaleMode = SKSceneScaleModeAspectFit;
self.physicsBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:self.frame];
self.physicsWorld.gravity = CGVectorMake(0.0, -3.0);
self.physicsWorld.contactDelegate = self;
[self addChild:self.currentBackground];
}
Upvotes: 0
Views: 1239
Reputation: 223
Just found the fix, needed to change the .h file to, conform to the protocol, like this:
@interface MGLCreateMainGameScene : SKScene <SKPhysicsContactDelegate>
Needed to add the <SKPhysicsContactDelegate>
Upvotes: 3