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!
1 Answer
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.
-
\$\begingroup\$ 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? \$\endgroup\$Seany242– Seany2422012-02-26 15:40:18 +00:00Commented Feb 26, 2012 at 15:40
-
1\$\begingroup\$ @Seany242 Use sprites, it's going to be faster and easier than drawing filled circles with only OpenGL (eg. without a sprite texture). \$\endgroup\$bummzack– bummzack2012-02-27 07:55:49 +00:00Commented Feb 27, 2012 at 7:55
-
\$\begingroup\$ Sorry for the late reply, but @bummzack is right, using a sprite is simple and will be fasted due to cocos2d texture cache. \$\endgroup\$Robin– Robin2012-02-27 08:04:05 +00:00Commented Feb 27, 2012 at 8:04
-
\$\begingroup\$ how would i change the color of the circle during the game if I import a white sprite? \$\endgroup\$Seany242– Seany2422012-02-29 23:48:32 +00:00Commented Feb 29, 2012 at 23:48
-
\$\begingroup\$ Set the tint color of the image, that should take care of it. \$\endgroup\$Robin– Robin2012-03-01 01:23:38 +00:00Commented Mar 1, 2012 at 1:23