I have a simple class that extends CCLayer. The constructor looks like so:
Space::Space()
{
//setup anchorpoint
this->setAnchorPoint(ccp(0.5,0.5));
//initialize the sun
sun = Sun::create(world, 20);
sun->setPosition(ccp(0,0));
sun->retain();
this->scheduleUpdate();
this->setTouchEnabled(true);
//sprite
CCSprite *sprite = CCSprite::create("Icon.png");
this->addChild(sprite);
}
When I add the sprite to the layer it is added as if the anchor point is still ccp(0,0). How can I set the anchor point of the layer to ccp(0.5,0.5)? Also, bonus question, how do I format code properly to display in the forum?