Hi!
I have a problem that is safe of mathematics , and not of SFML.
I'm doing a game ships(sprite), and bullets do not go according to the rotation of the ship, go up.
If the ship has a rotation of 90 degrees and the bullets too, but do not follow the direction of the ship. The bullets rotate the same but if the ship is moving at x: 10, the bullets continue straight y: 20+
CBullet::CBullet(float x,float y,float r,E_BULLET_TYPE t)
{
//# Carga la images
img_bullet.LoadFromFile("media/sprites/bullet.png");
img_bullet.SetSmooth(false);
//# Crea el sprite
spr_bullet.SetImage(img_bullet);
//# Posiciona el sprite
spr_bullet.SetPosition(x,y);
//# Centro del sprite
spr_bullet.SetCenter(spr_bullet.GetSize().x/2.f,
spr_bullet.GetSize().y/2.f);
//# Gira el sprite
spr_bullet.SetRotation(rot);
//# Variables
type = t;
rot = r;
}
void CBullet::Update(bool mov)
{
if(mov)
spr_bullet.Move(-400.f * App.GetFrameTime());
App.Draw(spr_bullet);
}
In other libraries have not had problems doing this, but this is not how.
I've searched the forum but there is no convincing answers.