I don't mean to be rude, Dannydaninja, but you're being far too general.
Here is a way:
First, you need to set a variable so that flash can render more than one bullet at a time. On the main stage actions panel, enter: bulletNum=0
Next, create a movie clip to serve as the player, and in the library panel, give it the linkage, "layer" (right click the movie clip in the library panel, and scroll to linkage. Select "export for actionscript" Enter this into the main stage actions panel: var player:MovieClip = _root.attachMovie("layer","layer",1) player._x=550/2 player._y=400/2 For the generic 550x400 stage used by flash, this will place the player in the center of the stage.
Now create a new movie clip to serve as the bullet. Give this the linkage "bullet"
Now you need to create a mouse listener to detect if the player has clicked. Enter this in the main stage actions panel: var mouseListener:Object = new Object() mouseListener.onMouseDown=function(){ var bullet:MovieClip = _root.attachMovie("bullet","bullet"+bulletNum,100+bulletNum) bulletNum++ bullet._x=player._x bullet._y=player._y bullet.speed=5 bullet.rads=Math.atan2(_ymouse-player._y,_xmouse-player._x) bullet.onEnterFrame=function(){ this._x+=this.rads*this.speed if(this._x>550 || this._x<0 || this._y<0 || this._y>400){ this.removeMovieClip() } } } This will shoot a bullet from the player in the direction of the mouse every time the player presses the left mouse button.
Thanks arobe but I'm getting another character and another bullet, my main character moves while the other one that appears does not, and the bullet shoots from the unmovable character, if I remove the "attach movieclip" code I go back to square one. Any idea how to fix this?
It sounds like you started with another movie clip on the stage. You're main stage should be completely blank, with two clips in the library. If you want a moveable character, you could add this to your main stage actions, to control the player with the arrow keys.
Thanks for the reply, but the thing is, I gave the gun a linkage of player, because I want the bullet to fire from the gun, so how do I make the newly attached gun move like the gun that is inside the character?