First thing, it's good practice to put your code in a code box, that way you don't lose any formatting (i.e. indenting). In the message window, highlight your code, press the code button in the top right of the message window.
Ok, looking through your code I'm seeing quite a few issues.
Probably the most fundamental is that you're not changing the position of the bullet sprite at all.
You need to use the Xp# and Yp# variable to position the sprite.
The other issue you have is that the x and y velocities of the bullet do not change, so the bullet will always move off in the same direction and speed. I use the term velocity in it's strictest sense.
Now, to get you out of having to use trig we can deal with the x and y velocities seperately. Yes, we can do that, I've been a mechanical engineer for ten years so trust me (but I'm nothing like Wollowitz off the Big Bang Theory before you ask).
A velocity has both magnitude and direction. The magnitude is just how fast something is moving (i.e. it's speed) and the direction is whether it's going to be a positive or negative value.
The direction of the x velocity can be fixed as you have placed the turret on the far left of the screen. Therefore the x velocity is always going to be positive (i.e pointing to the right), you can then set the value as a constant at the start of the program if you want.
The y velocity is going to change, in its direction (i.e. moving the bullet up the screen or down the screen) and in its maginatude, otherwise the bullet will always move off at the same angle (positive or negative).
In the demo the y velocity of the bullet is calculated using the principle of simillar triangles. I.e. the position of the mouse relative to the... it's easier if I just attached a picture.
The demo below shows the basic principle or how to get the bullet to move. I've taken out the bullet stopping if you realese the mouse button but the bullet position will reset if goes of the screen. I've also created a couple of sprites in the code so you won't require any media.
`press left mouse button to shoot
sync rate 60
sync on
sw = screen width()
sh = screen height()
size = 10
`create a seperate bitmap and make a couple of placement images
create bitmap 1, sw,sh
set current bitmap 1
`turret, green box
ink rgb(0,255,0),0
box 1,1, size,size
get image 1, 0,0, size,size
cls
`bullet, yellow box
ink rgb(255,255,0),0
box 1,1, size,size
get image 2, 0,0, size,size
`set the current bitmap to the screen
set current bitmap 0
`set value for the x velocity of the bullet
Xvelp# = 2
`set starting values for positions of the turret and bullet
Xt# = 0
Yt# = 250
Xp# = Xt#
Yp# = Yt#
Do
`position the sprites
Sprite 1,Xt#,Yt#,1
Sprite 2,Xp#,Yp#,2
`get mouse positions
Mx#=MouseX()
My#=MouseY()
`shooting control
If MouseClick()=1
shooting=1
`this calculates the y velocity of the bullet using simillar triangles.
YvelP# = (My# - Yt#)*Xvelp#/(Mx# - Xt#)
endif
`move bullet if shot has been made
If shooting=1
Xp#= Xp#+Xvelp#
Yp#= Yp#+Yvelp#
endif
`reset the bullet position of it has move off the screen
If Xp# > sw or Yp# < 0 or Yp# > sh-size
shooting=0
Xp# = Xt#
Yp# = Yt#
endif
CLS RGB(255,255,255)
sync
loop
end
If you wanted the turret to move, i.e. have it as a tank, then you'll need to calculate the x velocity of the bullet based on the tanks position to the mouse.
You can calculate the velocity of the bullet using trig but if you don't know your sines from your cosine it can be a little tricky to pick up.