Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently making a game similar to this Nyan Cat flash game, although I'm using cocos2d. I'm having a hard time trying to make the rainbow effect:

enter image description here

Currently, every update call I add a piece of rainbow on screen and move it back, having also added it into a special array. When a player changes its y coordinate I rotate all the added spites by a certain calculated value.

Honestly, it looks... not perfect and I've been wondering if there is better way?

share|improve this question
Think you can add an appropriate image instead of a link to a flash site? That would help this question stay useful. – Byte56 Jul 11 '13 at 13:29
Most likely the issue comes from you just rotating the sprites. I don't know if Cocos2d has something built in to help with rail rendering but if it does not you can make the curve piece by drawing the rainbow tile as a pie slice rather than an actual tile. I can't say I know the math behind this, but I'm guessing your issues come from drawing the tiles over one another. Without a image or a better explanation of what your issue looks like I can't really suggest anything more than that. – Benjamin Danger Johnson Jul 11 '13 at 16:29

There's a special class available in cocos2d that renders a ribbon of quads for you. At one point it was named CCRibbon, but I think it has been changed to CCMotionStreak (docs). It's designed to render trails or ribbons. I think using that class would be the most efficient way to create such an effect.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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