[FlashCS3/AS 2.0]Shoot towards mouse pointer

I’m just just starting ActionScript (and programming) and I’m trying to learn by making a game step by step. I don’t know if it’s the best way to start, but at least I can see what knowledge I’m lacking that way.
Anyway, I’ve been fine so far but now I’m facing a problem with making my character shoot in the proper direction, which I describe below (I’m sorry, it’s a long post, thanks to those who will be patient enough to read it entirely):

My game is supposed to be some sort of real time RPG. Camera view is from top to bottom and the general aspect of the game would be a character walking through a city and shooting enemies along the way.
The character moves with the arrow keys, and he rotates by following the mouse pointer (which means he keeps pointing towards the pointer). The character actually doesn’t move, it’s the map that does (the character rotates however).
Just a little question here (depending on the answer, my main question might be useless): is it a good idea to make the map, enemies and items move instead of the character? If not, could you please explain why?

And now, for my main question:
The map movement/illusion of character movement with the arrow keys is going fine, as well as the rotation of the character with the mouse. However, I also want him to shoot towards the mouse pointer whenever I click the left mouse button but I don’t know how to do this.
I’ve been looking for tutorials on the web, as well as searching this forum, and I understood that the script would require use of trigonometry (at which I don’t know a thing).
I also tried making my own script using a combination of the script used in the linear shooter tutorial on this website, and the script used in the “Detecting direction of mouse movement” tutorial. But all I could get was the projectile moving from the center of my screen to the top left direction of the screen and it’s path only slightly changed by the movement of the mouse pointer.

Here is my script (I put it in a frame, in an independent layer with nothing else on it. The projectile is in the library, not on a layer):

var spriteX:Number = 1000 ;
var spriteY:Number = 500 ;
var arrowActive:Boolean = false;

//---- functions ----

this.onMouseMove = function() {
xdir = _xmouse;
ydir = _ymouse;

};

function checkKeys() {
if (Key.isDown(Key.SHIFT) && arrowActive == false) {

attachMovie(“arrow”, “arrows”, 8);
arrows._x = spriteX ;
arrows._y = spriteY ;
arrowActive = true ;
}
}

function updateArrow() {
if (arrowActive == true) {
arrows._y -= ydir/100 ;
arrows._x -= xdir/100 ;
}

if (arrows._y<-10) {
arrowActive = false;
removeMovieClip(arrows);

}
}

this.onEnterFrame = function() {
checkKeys();
updateArrow();

  • Arrow is my projectile, I drew a small red dot and called it “arrow” in order to match the script from the linear shooter tutorial, and I don’t know what “arrows” is referring too because I couldn’t find anything about it in the tutorial (and I did not name anything “arrows” myself, but if I remove it from the script it seems it completely stops working).
  • My map is 2000x1000

What I need is a script that does the following:

What I can’t do:

  • Make a projectile move from the tip of the gun to the mouse pointer (tip of the gun does not stay in place since the character rotates. Plus, the character will use different guns, some shorter than others). Also, the projectile should not follow the pointer once it is shot.
  • I’d like the projectile not to hit the pointer accurately. Imagine a straight line going from the gun to the mouse pointer; the projectile should follow a straight line randomly set between 0 and x degrees left or right from this line. I would like x to be set in a variable so I could change it. This is in order to make the gun slightly inaccurate.
  • The script should still allow me to make something happen when the projectile collides with something (I’ll do the collision part myself later, right now I just don’t want the script to prevent me from doing it)

That’s the hardest part for me, the rest following below I might be able to do it myself but I don’t know for sure, so any help is appreciated but not necessary if you don’t want to waste your time:

  • The script should use a variable for projectile’s speed so that I can change it.
  • The projectile should disappear after traveling a specified distance and the script should use a variable to set this distance.
  • The script should allow to shoot another projectile before the first one disappears (right now I need to wait until the projectile exits the map before I can shoot again and I don’t know why). I also need the delay between each shot to be set in a variable so that I can change the rate of fire of the gun.
  • I’m also looking for a script that makes several projectiles be shot at the same time, following a different angle (according to the inaccuracy angle I described above), and I would like to set the number of projectiles being shot simultaneously with a variable.

And here’s what I think I can do myself:

  • The projectile should only be shot when the left mouse button is pressed.

If you give me a script, I would really like it if you could briefly explain it’s different parts and how it works. That way I could understand it and learn something, rather than just copying it. I really don’t like to ask people to do the work for me, but since I can’t find any tutorial I have to ask for help. I’m also aware that maybe I should train a bit more before trying to do such programming, but I won’t know for sure until I ask. I’m not a newb who believes he can program great games in 5 days. I’m just doing what I can, and I’m asking for help as less as possible. If I ever see I get stuck too often, I’ll train more before continuing.

Thanks in advance to anyone that will help me, any help is really appreciated even if you can’t solve my problem entirely. And thanks for reading my post until the end. I know it was long, but I wanted to be as clear as possible so that you wouldn’t waste your time asking me for more details.