Domanda

I'm new to Cocos2dx and I'm trying to create a planet animation rotate itself by using a 3:1 rectangle texture, which contains 3 squares are two faces (map) of sphere (the third square is a clone of the first one). I create a frames array by cropping the texture and add them to CCAnimation. Then I test this animation with two effects to make square frame become a 3D circle: CCLens and CCTurnOffTiles (I will modify it in the future to turn off only grids outside the circle).

But there is a problems: two effects don't stack. If CCTurnOffTiles is added after CCLens, CCLens will not work; if CCLens is added after CCTurnOffTiles, CCDirector will throw reading violation exception at runtime.

Is there any solution to run many effects simultaneously or implement planet animation in other way? Thanks.

È stato utile?

Soluzione 2

Both CCTurnOffTiles and CCLens3D inherits of CCGridAction.

But one cancels the other: CCTurnOffTiles will turn off grid tiles, and CCLens3d need these grid tiles.

I recommend you to draw all planet sprites, already circled and using a SpriteSheet, and animate then with CCAnimation, without using CCTurnOffTiles or CCLens3D. It is easiest and will consume less cpu.

Altri suggerimenti

Try using CCSpawn.

// Create the effects
CCLens3D * lensEffect; // Your CCLens3D create()
CCTurnOffTiles * turnOff; // Your CCTurnOfftiles create()

// Create a spawn to run them simultaneously
CCSpawn * sphereEffect = CCSpawn::createWithTwoActions( lensEffect, turnOff );

// Run the spawn
myObject -> runAction( sphereEffect );
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top