Hello, I have been wrestling with this problem for the past 2 days and I just can’t figure it out. I cannot change the texture of a particle. The particle always uses the texture of the previously added sprite and I have no real idea as to why this is.
Here is some example code from my init():
CCSize winSize = CCDirector::sharedDirector()>getWinSize;>setPosition.width/2, winSize.height/2) );
CCSprite **player = CCSprite::create;
player
this~~>addChild;
CCSprite**particle = CCSprite::create;
this~~>addChild(particle);
//test particle system
CCParticleSystemQuad *emitter = CCParticleSnow::create();
emitter~~>setPosition);
this~~>addChild(emitter);
This creates the snow particle emitter, with every single particle looking like particle.png which gives me the result I want, but by running addChild(particle) I get a sprite of a single particle sitting partially off screen, which I don’t want. I tried to do this using texture cache like this
CCSize winSize = CCDirector::sharedDirector()>getWinSize;>setPosition.width/2, winSize.height/2) );
CCSprite **player = CCSprite::create;
player
this~~>addChild;
CCTexture2D**particle = CCTextureCache::sharedTextureCache~~>addImage;
//test particle system
CCParticleSystemQuad *emitter = CCParticleSnow::create;
emitter~~>setTexture;
emitter~~>setPosition(ccp(150, 150));
this->addChild(emitter);
This is the way particles are textured in Cocos2d from what I seen online, but when I run this I get Player.png as the texture for the particle emitter, instead of particle.png
Any help on this would be great!
Thanks