Hello everyone,
Thanks for a great forum. I am both new to using cocos2dx and C++ in general.
However during the last of days I have started to develop a game using these two tools.
Now I have run into a problem with (at least I think this is the problem) my sprites not being retained properly.
Below is my code:
bool GameSceneView::init()
{
>
if (!CCLayerColor::initWithColor(ccc4(255,255,255,255)))
{
return false;
}
>
*backgroundNode = CCParallaxNode::create;
this~~>addChild;
>
CCSprite* *grass = CCSprite::create;
>*grass~~>retain;
>*backgroundNode->addChild(*grass, 0, ccp, ccp);
CCLog.x);
>
return true;
}
>
>
void GameSceneView::update
{
CCLog.x);
}
The game crashes with the error “Access violation reading location 0xCDCDCDCD” when the update function is called and I am trying to log the x coordinate of the*grass sprite.
What am I doing wrong with regard to retaining my _grass sprite?!
Thanks for your help!
//fischer