Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. Create a CCSprite subclass with a UIBezierPaths property
  2. Initialize the UIBezierPaths instance
  3.  
  4. Allocate the CCSprite subclass in a layer
  5. schedule updates
  6. In update method
  7. Reposition the CCSprite sublcass instance by getting the CGPathGetCurrentPoint to CGPathGetCurrentPoint
  8. Move the path forward by calling "move to next point"
  9.  
  10. - (CCBezierTo*)bezierMoveTo:(CGPoint)destination node:(CCNode*)node duration:(float)d {
  11.  
  12. static ccBezierConfig bzPaths[5] = {
  13. {{1050, 900}, {1200, 1400}, {1100, 900}},
  14. {{1100, 750}, {1300, 1550}, {1650, 500}},
  15. {{800, 850}, {500, 1100}, {400, 700}},
  16. {{700, 700}, {1500, 1200}, {400, 900}},
  17. {{900, 650}, {100, 900}, {900, 400}}
  18. };
  19. ccBezierConfig bezierOne;
  20. bezierOne = bzPaths[PATH_INDEX];
  21. return [CCBezierTo actionWithDuration:d bezier:bezierOne];
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement