Reputation: 25
I'm aware that this question has been asked before, but there was no answer.
I have objects which are linked with the player using the following code:
if (CGRectIntersectsRect(Player.frame, obstacle.frame)) {
[self finish];
// later on in the code i then hide the obstacle
obstacle.hidden = YES;
}
but when the object is hidden it still detects a collision is there away to remove collision when the object is hidden ?
Upvotes: 0
Views: 39
Reputation: 1078
You probably have to provide more Information but why don't you check whether the obstacle is hidden before you execute the collision-code?
if (obstacle.hidden != YES) {
// collision-code
}
Upvotes: 1