Basically this is what I like to do:
-(void)didBeginContact:(SKPhysicsContact *)contact
{
uint32_t collision = (contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask);
if (collision == (CNPhysicsCategoryCat|CNPhysicsCategoryBed)) {
_catNode.userData = [@{@"catOnBed":@(YES)} mutableCopy];
//Code here can let me wait for 3 seconds or something.
(_catNode.userData[@"catOnBed"])?[self win]:[self lose];
}
if (collision == (CNPhysicsCategoryCat|CNPhysicsCategoryEdge)) {
[self lose];
}
}
So I want the detection be done 3 seconds after the contact happens.
I tried dispatch_time method and it returns "breakpoint 2.1" to me. Screenshots below:
Then I also tried performSelector method and it tells me undeclared "detectContact..."
I also created the method, here is the evidence.
And then I tried SKAction sequence method (I think this one is closed). And it failed too:
And here is the stack trace: