android - Cocos2d-x Parallax Infinite Scrolling Error -
good day,
i writing code infinitely scroll parallax, can't seem correctly.
here code:
size visiblesize = director::getinstance()->getvisiblesize(); vec2 origin = director::getinstance()->getvisibleorigin(); auto mountainsprite = sprite::create( "mountain.png" ); auto treessprite = sprite::create( "trees.png" ); auto housessprite = sprite::create( "houses.png" ); auto paranode = parallaxnode::create(); paranode->addchild(mountainsprite, -1, vec2(0.4f,0.5f), vec2(800,480)); paranode->addchild(treessprite, 1, vec2(2.2f,1.0f), vec2(800,480)); paranode->addchild(housessprite, 2, vec2(3.0f,2.5f), vec2(800,480));
the result black blank screen.
also, have follow-up questions:
can replace "vec2(float xx, float yy)" "point(x,y)" here? because seems not of cocos2d-x version 3.6? "ccp(x,y)"? better vec2, point or ccp?
what "positionoffset" "addchild (node *child, int z, const vec2 ¶llaxratio, const vec2 &positionoffset)", talks about? link: parallaxnode class reference
i tried tutorial: raywenderlich parallax tutorial, don't understand it, can explain me? things confused me "ccsprite" same "sprite", why?, "ccparallaxnode" same "parallaxnode", why?
and "[self addchild:_backgroundnode z:-1]" same "this->addchild(node)"?
any answer or suggestion questions appreciated. thanks :d
this->addchild(paranode);
try this.
Comments
Post a Comment