Positioning Shots Problem (asked by svn)

I'm making a shooter game. The shots are supposed to move to the mouse's position, but the necessary rules mean that when your character moves, and the mouse is on him, the shots stay where in the character. How can I tell it to move in a linear fashion, but it moves in a hypothetical invisible line stretching from the character to the mouse and beyond?(Sorry if this gets confusing, just play any web shooter game, like the excellent Commando 2[miniclip.com/games/commando-2/en/] , and watch how the shots move to see what I mean)
Comments
vector to angle expression: vectorToAngle(selfposition.x-mousepositon.x,self.position.y-mouse.position.y)
magnitude expression: magnitude(self.position.x-mouse.position.x,self.position.y-mouse.position.y)
tsb has a great video called distance between actors in the gamesalad cookbook that shows magnitude as well
that will have it shoot towards the mouse and keep going past it in the same direction, so it doesnt just go to the mouse and stop
you can do: -vectorToAngle(self.position.x-mouse.posiiton.x,self.posiiton.y-mouse.position.y)
since its going the opposite having the minus will make it the right way, thats still puzziling why its not working from the get go though
and i just remeber, the image of the player should be facing right to begin with, if its facing left thats why its shooting out the other side. Im refereing to the actual png you imported into gamesalad