Tuesday, January 12, 2010

AS 3.0 BitmapData based Destructable Terrain

Here is another bit of source code, that I had posted on the newgrounds BBS.
If you wish to know how to make BitmapData based destructable terrain (like in worms) in AS 3.0 check out the source code .

Here is basic example to see how it works:
example swf

Cheers and stay tuned!

AS 3.0 Key Controller

A while ago I had posted a Key Controller for AS 3.0 on the newgrounds BBS. So for all of you who are having trouble with key events and managing key presses in AS 3.0, here is the source and example .

You can use the controller like this (also check the example flash develop project that comes with the source code):
import source.ui.keys.KeyAction;
import source.ui.keys.KeyManager;

// init keymanager
KeyManager.init(stage);

// bind some keys to the predefined gameactions
KeyManager.bind("UP", "w");
KeyManager.bind("UP", "UP_ARROW");

// in your enterframe / game loop
if (KeyAction.UP) {
trace("UP");
}
Cheers and stay tuned!