0

I'd like to know if it's possible to fill a polygon shaped sprite with a squared/rectangular texture using cocos2d. I guess I will have to override the draw method, but I have no idea on how to achieve this and couldn't find any useful resources online.

Regards

rmonjo
  • 2,675
  • 5
  • 30
  • 37
  • Override draw, the rest is pure OpenGL ES. Here's some info **if** you're still using cocos2d v1.x: http://www.cocos2d-iphone.org/forum/topic/8142 – CodeSmile Sep 29 '12 at 22:30

1 Answers1

1

Simplest way to do that effect in cocos2D is to use CCProgressTime to show color fill effect.

 CCProgressTimer    *mProgressMeter;
 mProgressMeter = [CCProgressTimer progressWithSprite:[CCSprite spriteWithFile:TEX_SYRINGE_LAYER]];
 mProgressMeter.color = ccc3(102,0,204);
 mProgressMeter.percentage = 0.0f;
 [mProgressMeter stopAllActions];
 [mProgressMeter runAction:[CCProgressTo actionWithDuration:2.0f percent:80.0f]];
Guru
  • 21,652
  • 10
  • 63
  • 102