Do you really need an instance of CCSprite? you can subclass CCNode, then in
- (void) draw
enter your code here. your circle will have a central position (0.f, 0.f)
@implementation MyScene
- (void) onEnter
{
[super onEnter];
CCNode* myNode = [MyNodeSubclass node];
[node setPosition: someRandomPosition ];
[self addChild: node];
}
@end
@implementation MyNodeSubclass
- (void) draw
{
glColor4f(255, 255, 255, 255);
CCPoint center = ccp(0.f, 0.f);
CGFloat radius = 10.f;
CGFloat angle = 0.f;
NSInteger segments = 10;
BOOL drawLineToCenter = YES;
ccDrawCircle(center, radius, angle, segments, drawLineToCenter);
}
@end
wrote this piece of code right here, did not copy it from xcode, but it should work the way you want. ccDrawCircle is a cocos2d function declared in CCDrawingPrimitives.h
source
share