PDA

View Full Version : [AS2] Lightning/Laser/Pulse Gun Effect


pradvan
12-04-2008, 02:23 AM
This advanced script shows you how to create a lightning, laser, pulse and other effects using ActionScript 2. It is highly customizable and easy to modify to create your own desired effect.

Customizable Settings

reloadSpeed - how long it takes the gun to reload in milliseconds
clearSpeed - how long it takes to clear the graphics on screen in milliseconds
lightningOffset - how wide the lignting bolt is in pixels
lightningFrequency - how long each jump is in pixels
lightningWidth - set the width of each lightning bolt in pixels
lightningColor - set lightning color
lightningAlpha - set lightning transparency
lightningBranches - how many lightning bolt branches will be drawn per click
sparkNumber - set number of sparks
sparkDistance - set spark spread distance
sparkSize - set spark scale in percent


Screenshot
http://www.freeactionscript.com/download/screenshot/game-shooting-lightning-gun.jpg

Preview & Fla Download
http://www.freeactionscript.com/2008/12/weapon-lightning-gun-effect/

If you're having trouble understanding how this script works, please review previously posted examples that were incorporated in to this script:

Shooting Laser (http://www.freeactionscript.com/2008/2008/11/weapon-shooting-laser/)
Play Random Sound (http://www.freeactionscript.com/2008/2008/10/play-random-sound/)
Apply Filters Using Actionscript (http://www.freeactionscript.com/2008/2008/12/using-actionscript-filters/)
Sparkle Effect (http://www.freeactionscript.com/2008/2008/12/sparkle-effect/)


Feedback
As always, comments, suggestions, questions and rants are welcome

Happy coding :)

asf8
12-04-2008, 03:00 PM
Excellent work pradvan, thanks for sharing. I really appreciate the effort you are putting into your posts, code, comments, site. Some really good stuff pradvan keep up the great work.

I guess the only thing I might suggest for you to consider is to keep all code on the main timeline (AS layer) instead of in the buttons/movieclips also. I understand you might have a reason for this however but thats my only suggestion. Otherwise, again great work and thanks again for sharing pradvan, very nice examples!

PS: Is this the one you mentioned yesterday you were finishing up?

pradvan
12-05-2008, 02:53 PM
Thanks asf8! Getting good feedback makes me feel all warm and fuzzy inside :)

That was the most complicated/biggest script that I released. I know it could use a lot of tweaks but I just wanted to finish it already (and all the other scripts that were used in it) and release it. Spent a lot of time on it but it was well worth it I think (still have that warm fuzzy feeling ;))

About the script on buttons :o - I know it's a huge no-no, and I personally never put anything anywhere but the timeline ... BUT, this being a "lightning tutorial/code example", I didn't want to clutter the actual lightning code with all the preset effect examples, etc, so I just slapped all that stuff directly on the buttons.

And yes, that's the thing I was talking about :)