SDL Bullet Movement

I’m currently working on my first space shooter, and I’m in the process of making my ship shoot some bullets/lasers. Unfortunately, I’m having a hard time getting the bullets to fly vertically. I’m a total noob when it comes to this so you might have a hard time understanding my code :confused:

    // Position Bullet Function
    projectilex = x + 17;
    projectiley = y + -20;
        alive = true;

And here’s my show function


        if(frame == 2)
            frame = 0;
        projectiley + 1;

I’m trying to get the bullet to fly vertically… and I have no clue how to do that. I’ve tried messing with the y coordinate but that makes things worse. The laser/bullet just follows the ship :frowning:

How would I get it to fire at the starting position and keep going in a vertical line without it following the ship?
Thanks for your help!

Anyone?? Can someone walk me through this please!?

Pretty much any example will show how to move something on the screen in an easy way. Maybe to start with something that decides which direction(s) the motion is and then like:
if (P1_motion[0]) {ptrData->P1_y = ptrData->P1_y - P1_speed;}//up
if (P1_motion[2]) {ptrData->P1_x = ptrData->P1_x + P1_speed;}//right
if (P1_motion[4]) {ptrData->P1_y = ptrData->P1_y + P1_speed;}//down
if (P1_motion[6]) {ptrData->P1_x = ptrData->P1_x - P1_speed;}//left
Here I decided that there are 4 directions of motion and speed is either on or off with no speed up or slow down ramp. (acceleration)