Dear All, I'm currently learning Iphone programing and I'm having some trouble wrapping my mind around CAKeyframeAnimation
I'm using CAKeyframeAnimation to animate objects on the screen like so:
CGPathMoveToPoint(thePath, NULL, start.x, start.y); CGPathAddLineToPoint(thePath, NULL, finish.x, finish.y); animation.path = thePath; animation.duration = animationDuration;
// Add the animation group to the layer [Layer addAnimation:animation forKey:@"animate"]
I use this basic idea to move my objects about but now I would like to be able to detect collision between objects.
I was thinking of adding to each animated objects on the screen an observer [animated addObserver:...]
and let when the position changes call up a method that checks the current position against the posiiton of all the other animated objects.
problem is there could be a lot of objects (maybe up to 100 (estimation but maybe more)), moving about to check against a list of 10 - 20 objects for collisions. therefore I'm worried that its going to be a lot of test at each iteration.
what would you suggest me to do?