struggling with loops

Hi there, I am trying to make my first SFML game.

Basically the game consists of a tank sprite and a bullet sprite. The problem I have is with the shooting of the bullet. I went about drawing the bullet under the tank and then to move it as the tank moves.

I can't seem to get the bullet to go by its self. Here is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
...
float rotation = Tank.GetRotation();
if((App.GetInput().IsKeyDown(sf::Key::Space) && 
(rotation == 90))
{
    If(Bullet.GetPosition().x > 0)
   {
       Bullet.Move(400 * FrameTime, 0);
       If(Bullet.GetPosition().x < 0)  
      {
         Bullet.SetPosition(Tank.GetPosition());
      }
   }
}


I don't know if this is the best way to do it, but it's all I could get to work.

Thanks

FR3DDIE
Topic archived. No new replies allowed.