Hello, i’m having a little trouble with Parallax Node.
Here’s my code: i’ve created a class for handling background layer. One constructor create a parallax node receiving the texture path as input, as shown below, but after launching the app, i cant’see anything (while adding a simple texture to a cclayer works). Any suggestion?
bg = CCLayer::node();
bgParall = CCParallaxNode::node();
CCSize size = CCDirector::sharedDirector()->getWinSize(); int i = 0; int count = 4; int zOrder = count - i; CCSprite* tmp = NULL; tmp = CCSprite::spriteWithFile(bg1); tmp->setPosition( ccp(size.width/2, size.height/2) ); bgParall->addChild(tmp, zOrder, ccp(1,0), ccp(1,0)); bg->addChild(bgParall);
then “bg” is added to the main scene.