Game Weapons - Pistols, Shotguns & Machine Guns

Monday, April 6th, 2009 | Game Examples AS2, Game Weapons

This AS2 example shows you how to make projectile weapons for your flash games; a pistol, a shotgun, and a machine gun. Holding down the mouse button allows you to fire continuously.

Note: Latest version of this script is located here:
http://www.freeactionscript.com/2009/06/flash-game-projectile-weapons/

Download Fla Sample

Download Fla Sample


Tags: , , , , , , , , , , , , , ,

10 Comments to Game Weapons - Pistols, Shotguns & Machine Guns

imoncloudnine69
April 7, 2009

Just what i needed! I tried several things to make a spread shot. I just didnt think of using a loop inside the function. good call. A++

pradvan
April 8, 2009

Glad you found it useful :)

Werty2334
April 9, 2009

any ideas on how to make the bullet fire from the tip of the gun instead of the middle. I tried changing the bullet position but no luck

pradvan
April 13, 2009

Werty2334; i will fiddle around with the fla and see. Will post results here

NoahJ
April 13, 2009

Hey Werty2334, I thought I’d post some code (that I used in a previous project) in response to your comment. Replace the following code:
-
tempBullet._x = player_mc._x;
tempBullet._y = player_mc._y;
-
With:
-
tempBullet._x = player_mc._x+15*Math.cos(player_mc._rotation*radians);
tempBullet._y = player_mc._y+15*Math.sin(player_mc._rotation*radians);
-
You can replace the 15 with any distance you like (in pixels). Hope it helps! I’m looking forward to your solution as well, pradvan.

- Noah

boggie
May 14, 2009

Hi, good job man, great stuff.

I am trying to make a game, and I can seem to get a hitTest to work with the bullets hitting an object.

Let me know what to do. Thanks.

-Boggie

kyouki
June 7, 2009

Im With Boggie ^

I am using this scrip with a few changes and custom work, but no matter what I try I can’t get the hit test to work, I have read the script over and over and tried differnt thing, looked at other .fla this dev has made and still can’t figure it out. Anyone have an idea to get hit test to work

OrangeAce
June 7, 2009

When I try using the enemy follow script with this script, the enemies follow my character but the character does not shoot whenever I click, my character cannot rotate towards the mouse as well. Is there someway the script can be tweaked so that it does not interfere with this script?

pradvan
June 8, 2009

Hi guys, I will release an update to this script sometime this week. It should address all your issues.
Thanks,
PR

Leave a comment

You must be logged in to post a comment.