2
\$\begingroup\$

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!

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
5
  • \$\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\$ Commented 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\$ Commented 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\$ Commented 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\$ Commented Feb 29, 2012 at 23:48
  • \$\begingroup\$ Set the tint color of the image, that should take care of it. \$\endgroup\$ Commented Mar 1, 2012 at 1:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.