How do I put this behind the player at all times?

Okay, so I got some particals that I want to come from behind the player, but I don’t know the math to do it. How do I position something behind a rotating player? This is what I got: (x, y, angle)


playerBooster.resetPartical(player.x + ((player.width/2) - (playerBullet.width[0]/2)), 
				player.y + ((player.height/2) - (playerBullet.height[0]/2)),
				(player.angle - 180));

If you know the angle that the player is facing, then all you need to do is add PI (or 180, depending on units) to that angle, then use sine and cosine to figure out how this translates into X and Y coordinates.

Like this:


//The angle I'm facing.
float myAngle = foo;

//My position on the screen (center).
float myX = foo;
float myY = foo;

//The radius from my center to spawn particles.
float myRadius = foo;

//How fast the particle is being projected.
float particleProjectSpeed = foo;

float backAngle = myAngle + Math.PI;
float particleSpawnX = myX + Math.cos(backAngle) * myRadius;
float particleSpawnY = myY + Math.sin(backAngle) * myRadius;
float particleVelX = Math.cos(backAngle) * particleProjectSpeed;
float particleVelY = Math.sin(backAngle) * particleProjectSpeed;

Just remember that cos always represents the X, and sin always represents the Y.

Sound to me like something more for iether newless clubbies, Game Play/Design or even physics boards