Free ActionScript

Home

AS3 Scripts

AS2 Scripts

Resources

About

Contact

Here’s a very simple Flash flashlight effect that uses almost no ActionScript. The only AS used is for rotation and key detection.

The effect is archived with a mask and a filter. The filter is a simple gradient fill, same color as the “dark”. One side the alpha is 100, the other size alpha 0. Both the mask and the filter are the same shape and size (I’m using the same movieclip actually). To make everything work, you have to rotate and move the filter and mask at the same time (along with the player).

Preview

Download Fla Sample

Also note the center registration point for the filter, mask and player. Make sure everything is aligned or the effect will break.

wow nice effect it can works awesome in a zombie game or a escape puzzle game! i think you shoudl try adding a side scrolling tutorial… cause at the moment all teh tutorials here are birds view

Yh that would be great – it wouldn’t be too hard…

Just make everything but your character move in the opposite direction when you move. eg – you press right and everything moves left and your character animates walkign right. Simple! (I think…)

Converting stuff to a side-scroller from birds-eye is pretty simple I think. You just remove one of the axis

This is pretty awesome! But I have one problem:

I want to use this in a maze game, and thus I’m using a hitTest to keep the character within the “walls”. Here I use a little script with a nifty “bounce effect” on hitTest .

However, I can’t figure out how to make the flashlight stop when hitting the walls as well.

Any ideas?

Thanks a bunch in advance!

Hi kollalfa,

Sorry but there’s no easy way to stop the light from going through the walls without rewriting the whole thing from scratch using Bitmap data.

Ok, thought so. But thanks anyway! -kollalfa

thank so much.. i have used it on my zombie games, and the game will be released in e few next weeks. if it is possible please make more script/effect for as2 thanks

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