Free ActionScript

Flash AS2 & AS3 Tutorials, Game Code, Effects, Source Files & Sample Downloads

Dynamic Bitmap Particle Explosion

Here is a new Dynamic Bitmap Particle Explosion effect.

This is an update to the previous dynamic explosion effect that used movieclips instead of BitmapData. The bitmap version works much faster and smoother. Check out this post for BitmapData usage examples.

Preview

Download Fla Sample

Download Fla Sample

Realistic Bitmap Smoke Trailer

Here is a new Bitmap Realistic Smoke Effect.

This is an update to the previous smoke effect version that used movieclips instead of BitmapData. The bitmap version works much faster and smoother. Check out this post for BitmapData usage examples.

Preview

Download Fla Sample

Download Fla Sample

Target Closest Enemy MovieClip

I’ve been thinking about how targeting the closest enemy would work and started experimenting with the algorithm. Basically AS has an array method called sortOn, that sorts objects properties in any order you want. Well, that’s the catch. It only sorts objects, not movieClips.

The work around is simple enough; when creating a new enemy object, just save a reference to the movieClip on stage inside the object’s property.

Preview

Download Fla Sample

Download Fla Sample

Update:
ActionScript 3 version of this script is available here:
http://www.freeactionscript.com/2011/07/game-enemy-manager/

Random Movement & Random Direction Change

Here is an ActionScript 2 enemy ai script that allows you to create enemies that move around randomly inside a container movieclip and randomly change direction.

Preview

Download Fla Sample

Download Fla Sample