cocos2d x - Parallax effect on tile map layers -
I am using three layers of tiled map and I want to give a vertical effect on these layers. My code is:
cctmcyclizedmark * city = cctmixedmarket :: build ("citymix"); CCTMaclayer * Foreground Layer = City-> Named Layer ("Foreground"); CCTMxlayer * Background Layer 1 = City-> Named Layer ("Background 1"); CCTM Accelerator * Background Layer 2 = City-> Renamed ("background 2"); CCParallaxNode * voidNode = CCParallaxNode :: Create (); // Now 3 layers have 'zero' node voidNode- & gt; Add Child (Picture Layer 2, -1, CCP (0.4 F, 0.5 F), Add to CCPointZero); VoidNode-> Add Child (Background Layer 1, 1, CCP (2.2 F, 1.0 F), CCP (0, -200)); VoidNode-> Add Chald (foreground layer, 2, CCP (3.0F, 2.5F), CCP (200,800)); VoidNode-> RunAction (temporary); // Some action temp addChild (voidNode); This claim fails: child-> m_pParent == 0 If we use sprites instead of TMXLayers, then the same code works. Did I do wrong in this code?
Layers are already the child nodes of CCTMextredmark. Only one parent can be in the node.
You can try to remove each layer before your parents, you can add them to voidnode. Although it is likely that this will not work because the layers may depend on their tilemap guardian.
Comments
Post a Comment