Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How can you make filled-in circles in cocos2d? I understand you have to create a new method, but I don't really understand how it works/how to do it. Could someone please provide maybe an example or tell me how to go about achieving this? Also, I need to create about 24 filled-in circles, would this cause lags of some sort? Thanks!

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

I am not sure what do you mean by "I understand you have to create a new method, but I don't really understand how it works/how to do it." but I can tell you how to create a filled circle in cocos2d.

All you need is an image of circle of any color that you want or a white one if you want to change the color of the circle in your game.

With these circles as sprites in the game, the lags should not occur as I have a game that has 70-80 sprites in a game(A Cards game) and it never lagged even when i played pretty complicated animation in the game.

share|improve this answer
    
Thanks for the sprite idea. I add the circles to the screen in a for loop however, using the ccDrawCircle function inside the draw method. How can I add the 24 circles onto the screen fast and easily? –  Seany242 Feb 26 '12 at 15:40
1  
@Seany242 Use sprites, it's going to be faster and easier than drawing filled circles with only OpenGL (eg. without a sprite texture). –  bummzack Feb 27 '12 at 7:55
    
Sorry for the late reply, but @bummzack is right, using a sprite is simple and will be fasted due to cocos2d texture cache. –  Robin Feb 27 '12 at 8:04
    
how would i change the color of the circle during the game if I import a white sprite? –  Seany242 Feb 29 '12 at 23:48
    
Set the tint color of the image, that should take care of it. –  Robin Mar 1 '12 at 1:23
add comment

Your Answer

 
discard

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.