Free ActionScript

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

Physics – Multiple objects (balls) colliding

After months and months of trying to figure this one out, I finally managed to build a fully working example!

So, here is the first version of my Simple Physics script – multiple balls colliding and bouncing off each other.

Preview

Download Fla Sample

Download Fla Sample

I have to give credit to a book called HTML5 Canvas by Steve Fulton & Jeff Fulton (great book!). It was very hard to grasp the law of conservation of momentum without it. Thanks guys!

Drag, Drop and Snap Inventory System

My latest AS3 Game Inventory System.

Features

  • Drag, drop and snap
  • Create/destroy inventory containers
  • Create/destroy level containers
  • Move items between different movieclip containers
  • Create/destroy items in level
  • Create/destory items in inventory – new
  • Find empty inventory slot – new
  • Added item selected/diselected state – new
  • Added slot full/empty state – new
  • Code optimization and more comments – new

Preview – v1.1.2

Download Fla Sample

Download Fla Sample


Wishlist

  • Stackable Items – items of the same type can be placed in the same slot
  • Auto-pickup item – items placed in bag automatically, if bag has space
  • Multiple Level containers – different game levels
  • Multiple Inventory containers – bag, bank, store
  • Destroy items
  • Sell items
  • Show Item Tooltips

Bug Fixes
v1.1.2

  • Fixed bug when releasing mouse over item, while holding nothing – Thanks 19greg96!

v1.1.1

  • Fixed “slot full” bug after removing item from slot – Thanks 19greg96!
  • Fixed publishing issue for Flash Player 10

AS2
Older AS2 version is available here:
http://www.freeactionscript.com/2008/11/drag-drop-snap-inventory-system-v2/

 

 

Game Enemy Manager

Enemy Manager code that handles basic enemy functions:

  • Create Enemy
  • Update Enemy
  • Get Closest Enemy
  • Destroy Enemy
Download Fla Sample

Download Fla Sample

Update – Version 1.1.0
Refactored code to be OOP

Scroller – Dynamic Scrollbar v2

A newer, better version of my scrollbar class. This one does not have any classes attached to movieclips. Instead you pass it a content clip, mask clip, track clip and slider clip like so:

_scrollbar = new Scrollbar();
_scrollbar.init(content, contentMask, track, slider);

This version also supports mouse wheel scrolling.

Download Fla Sample

Download Fla Sample