In chipmunk/cocos2d, I have the classic bouncing ball demo happily running with an arbitrary number of balls. How can I tell when a sprite has stopped moving (i.e. the ball has settled to the bottom and is "done")?
I tried declaring float prevX, prevY in the Layer class, so I could compare current x,y to previous x,y in updateShape, but I can't access the sprite's parent.
((CustomLayer *)(sprite->parent))->preX = body->p.x;
The compiler informs me that the sprite's parent is protected.
Thanks.