Track toolpath in cocos2d

how to track the ball trajectory in coconuts 2d

For example, in an angry bird, a game video moves a bird. they display the path. also i want

+7
cocos2d-iphone
source share
2 answers

You can accomplish this using NSTimer or CADisplayLink to reuse the coordinates of an object in its movement path (for example, 6 times per second) and display a small dot in that coordinate. The timer will begin, for example, in angry birds, when the bird is first launched, and then stops when the bird hits something.

  • a bird starts (a timer is created and the method is called 6 times per second)
  • Every 1/6 second a point draws along the coordinate of the bird at that moment
  • The timer stops when the bird gets there, so no more dots are drawn
+3
source share

You can use the CCMotionStreak Cocos2d class, which uses CCRibbon. Check out the Riq MotionStreak test on github (onEnter :)

+2
source share

All Articles