Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create a CCSprite subclass with a UIBezierPaths property
- Initialize the UIBezierPaths instance
- Allocate the CCSprite subclass in a layer
- schedule updates
- In update method
- Reposition the CCSprite sublcass instance by getting the CGPathGetCurrentPoint to CGPathGetCurrentPoint
- Move the path forward by calling "move to next point"
- - (CCBezierTo*)bezierMoveTo:(CGPoint)destination node:(CCNode*)node duration:(float)d {
- static ccBezierConfig bzPaths[5] = {
- {{1050, 900}, {1200, 1400}, {1100, 900}},
- {{1100, 750}, {1300, 1550}, {1650, 500}},
- {{800, 850}, {500, 1100}, {400, 700}},
- {{700, 700}, {1500, 1200}, {400, 900}},
- {{900, 650}, {100, 900}, {900, 400}}
- };
- ccBezierConfig bezierOne;
- bezierOne = bzPaths[PATH_INDEX];
- return [CCBezierTo actionWithDuration:d bezier:bezierOne];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement