0
\$\begingroup\$

I'd like to implement a trail (like the white circles in Angry Birds) that chase my sprite. I already used CCMotionStreak, but the trail texture is "stretched" instead.

Anyone has an idea how to make this?

\$\endgroup\$
  • \$\begingroup\$ Cocos has particle systems, no? \$\endgroup\$ – Sidar Jul 12 '17 at 16:44
  • \$\begingroup\$ Go for naive implementation. As @Frozsht answered, store last x position of your sprite and render white circles. But don't calculate x based on time otherwise you end up overlapping circles. \$\endgroup\$ – Emadpres Nov 5 '18 at 8:30
0
\$\begingroup\$

There are a few ways to do this. One would be to continuously store your sprites position points in an array that's updated to hold the last 20 positions or so depending how many you need for your trail. Then you can simply apply white circle sprites(or whatever you want the trail to be made of) on to only the current points in that array or every other current point in that array depending on the spacing you want. If you are using the update method to store your sprite position points remember to fix your time step or the position points might not be evenly distributed.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.