I’ve created a meteor particle using the function below. So far I have successfully made it appear on the screen and it follows my hero’s movement. Now I’m having trouble changine the “angle” of the “meteor particle”. no matter what float value i place inside “_comet->setAngle(175.45f);” still the meteor wont change angles. Help please?
void HelloWorld::createParticles() {
// CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
_comet = new CCParticleSystemQuad();
_comet = CCParticleMeteor::create();
_comet->setPosition(ccp(_balloon->getPositionX() - (_balloon->boundingBox().size.width / 2),
_balloon->getPositionY()));
_comet->setAngle(175.45f);
this->addChild(_comet, kForeground);
_comet->autorelease();
}
I believe setAngle
changes the angle of each particle instead of the whole system. Since CCParticleSystemQuad
inherits from CCNode
(eventually), have you tried:
_comet->setRotation(175.45f);
I also came across this problem.
Will there is a problem with particle emiter rotation handling, I suggest you modify the ParticleSystem header file, and add this :
float _emiterRotation;
setEmiterRotation(float val){
_emiterRotation = val;
}
float getEmiterRotation(){
return _emiterRotation;
}
and modify the cpp file either :
//You will find this in the initParticle(tParticle* particle) method
float a = CC_DEGREES_TO_RADIANS( (_angle + _angleVar * CCRANDOM_MINUS1_1()) + _emiterRotation );
//Modify the constructor two
ParticleSystem::ParticleSystem()
:_emiterRotation(0),
..............
This will work only if you move your particle using speed factor and not gravity.
Honestly there is lots to be said about particle movement, you will figure out what I mean later…
thanks, the “setRotation” works! buhahahaha