Position particles on sprite while moving

Position particles on sprite while moving
0.0 0


I need help with this… its driving me nuts…
I need to position particles on the back of my sprite. My sprite is spaceship and the particles is the engine firetail. So, when the spaceship moves around the particles have to move too.
I’m having problems to come up with the right code to always get the right position.

          //this is the spaceship
          Point normalized = targetPoint - this->getPosition();
                normalized = normalized.normalize();

                float angle = CC_RADIANS_TO_DEGREES(atan2f(normalized.y, -normalized.x)) + 270;
                Point desiredPosition = this->getPosition() + ( normalized * m_moveSpeed) ;

                int x=0;
                int y=0;
                //trying to make the particles to follow the spaceship.. not working properly.
                if(angle > 180  && angle < 270){
                    x= desiredPosition.x;
                    y= desiredPosition.y+40;
                }else if(angle > 270  && angle < 360){
                    x= desiredPosition.x-40;
                    y= desiredPosition.y+40;
                }else if(angle > 0  && angle < 90){
                    x= desiredPosition.x+40;
                    y= desiredPosition.y+40;
                }else if(angle > 90  && angle < 180){
                    x= desiredPosition.x+40;
                    y= desiredPosition.y+40;
                m_engine1->setPosition( Point(x,y) );

any help will be appreciated… tkx

How to get a screenshot in cocos2dx-3.0 rc0

you can try different particle position mode

    enum class PositionType
        /** Living particles are attached to the world and are unaffected by emitter repositioning. */
        /** Living particles are attached to the world but will follow the emitter repositioning.
         Use case: Attach an emitter to an sprite, and you want that the emitter follows the sprite.
        /** Living particles are attached to the emitter and are translated along with it. */


Thank you Wuhao!
I forgot post the particle creation code. I’m setting the PositionType to GROUPED… I’ll try with RELATIVE.
However, I’m not use the particles at all because my FPS is going down fast from 60FPS to 9FPS, because I believe I have too many particles on screen. In average I’ve 20 spaceships on the screen at some point and each of them will have at least 2 particles emitters, one for each engine.