Simple, just take the height and width and divide it by 2
CGSize winSize = [[CCDirector sharedDirector] winSize]; CGPoint point = ccp(winSize.width/2, winSize.height/2);
Here is a slightly more advanced way to do this. This will also work if you called setPosition on the sprite's parent (= self in this example)
CGSize winSize = [[CCDirector sharedDirector] winSize]; CCSprite* centerSprite = [CCSprite spriteWithFile:@"sprite"]; CGPoint centerPoint = ccpSub(ccp(winSize.width/2, winSize.height/2), [self position]); [centerSprite setPosition:centerPoint]; [self addChild: centerSprite];
s1m0n source share