Free ActionScript

Home

AS3 Scripts

AS2 Scripts

Resources

About

Contact

As the title suggests, this is a laser weapon script that shoots a laser beam. The beam stops when it hits solid objects. Written in AS2 to be used in Flash shooter games.

Download Fla Sample

If you’re having trouble understanding how this script works, please review previously posted examples that were incorporated in to this script: Shooting Laser Weapon & Apply Filters Dynamically .

Update: ActionScript 3 version of this script is available here:

http://www.freeactionscript.com/2011/07/laser-weapon-with-wall-collision-detection/

epic.

im just a little confused about accuracy, when i change it, it doesnt change how close to the mouse it is shooting, but rather how far through the blocks it goes? or like sometimes the blocks dont stop them and othertimes it stops in the middle. you might want to make that a var you shouldnt change? or if you could explain your reasoning.

maybe a name like penetration or something would be better suited?

Hi imoncloudnine69, Yes, you are absolutely correct. It should be called penetration instead.

Thank you! I believe it was I who requested this. However, I don’t think I’ll be able to use this much. Checking every pixel on its path is pretty resource heavy, and if I have a big array of enemies that move, that might be too much. On the other hand, I could possibly give this to some boss.. hmm.

Hi jonathanasdf, Yes, the script IS pretty heavy, but there’s no way around that. You can tweak the accuracy (which should’ve been called penetration), so it doesn’ check every pixel.

Also, you should not be doing a laser hit test on every enemy on the map. You need to start using broad phase/narrow phase collision detection.

Hey, maybe someone could try ( I know you’re busy ) the same script but with reflections off certain surfaces?

I know that would be pretty hard, but it would be worth it…

hi am doing something similar in flash. i want to know how to make the laser bounce of a mirror? please help me. many thanks ^_^

Hi azzjr6,

I believe you’re looking for this: http://www.metanetsoftware.com/technique/tutorialA.html

Thanks very much pradvan ^_^

You must be logged in to post a comment.

AS3 Effects

AS3 Gadgets

Game Examples AS2 Effects Animated Effects Dynamic Enemy AI Game Engine Game Weapons Images Interface Math Security

Effects Animated

Effects Dynamic

Enemy AI

Game Engine

Game Weapons

Images

Interface

Math

Security

Game Examples AS3 Basics Bitmap Blitting Collision Detection Enemy AI Movement Physics Space Shooter User Interface Weapon System

Basics

Bitmap Blitting

Collision Detection

Movement

Physics

Space Shooter

User Interface

Weapon System

Site Updates

718Hosting.com

Actionscript.org Forums

Flash Game Blogs

Flash Game License

Flashkit Forums

gotoAndLearn

IndieGames.com

Kirupa’s Tutorials

Kongregate Forums

MochiAds Resources

Philip Radvan

Photon Storm

Polygonal

Radvan Media

Tonypa’s Tutorials

Register

Log in

Entries RSS

Comments RSS

WordPress.org