Reputation: 21
I want to detect the boundary of a sprite when another sprite is moving to prevent the same position of sprites. How to do it? Any help....
Upvotes: 0
Views: 128
Reputation: 31081
You can schedule method to check position in init method
[self schedule:@selector(update:)];
and then
- (void)update:(ccTime)dt {
if (CGRectIntersectsRect(sprite1.boundingBox, sprite2.boundingBox)) {
//do what ever you want
}
}
Upvotes: 1