Free ActionScript

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

Drag Drop & Snap Inventory System v2

Drag, drop and snap inventory system for Flash games written in ActionScript 2.0.

I updated the previous version of my drag drop and snap inventory system to make it easier to understand. Added the ability to create new dragable items as objects. Also cleaned up & commented all the code.

Features

  • Slots Array
  • Create new Draggable Items
  • Drag & Drop Items
  • Dropped Items snap to Slot
  • Each Item stores Slot info
  • Each Slot stores Item info
  • Return to previous position if current slot is full

Drag, Drop & Snap Inventory System Sample v2

Download Fla Sample

Download Fla Sample

Update:
AS3 version of my inventory system is available here:

http://www.freeactionscript.com/2010/11/drag-drop-and-snap-inventory-system/

Game Engine – Minimap & Radar

This script shows you how to create a game mini-map or radar for your Flash games using ActionScript 2.0.

How this works:
The mini map is 25% scale of the actual map so we multiply the current minimap player position by 0.25 to get the 25% scale position.

Equation:
minimap.player._x = map.player._x * 0.25

Game Engine – Minimap & Radar

Download Fla Sample

Download Fla Sample

Weapons – Shooting Projectile Bullets v1.1

This script shows you how to shoot projectile bullets from the player movieclip towards the mouse x & y position.

Easy to use game weapon engine. Flash ActionScript 2.0.

Shooting Projectile Bullets Game Example

Download Fla Sample

Download Fla Sample

Customizable Game Weapon Settings

  • Bullet Offset – This set the accuracy of the bullet
  • Bullet Life Timer -  This sets the life span of the bullet based on frame rate
  • Bullet Speed – This sets the speed of the bullet
  • Reload Speed – This sets the reload speed of the weapon

Big Fix – 12.15.08
Fixed a bug where bullet offset was effecting the bullet starting position.

Update – 6.16.09
A new and improved version of this script is available here.
Read the rest of this entry »

Game Enemy AI – Follow Player

Flash ActionScript 2 game enemy AI. This script gives your enemies the ability to follow the player.

Download Fla Sample

Download Fla Sample

Customizable Enemy Settings

  • movement speed
  • turn rate
  • aggression range

Update
Check out the updated version of this script that incorporates different enemy behaviors in to one function, as well as creating multiple enemies at the same time: Enemy Behavior – Run Away & Follow Player