Sunday, April 27, 2008

Mapper - API for mapping numeric properties




View SWF online
Download FLA
Download API


I came up with the question:
"What if I want to map a numeric property to another property through a linear relation?
And what if I make this relation constantly true all the time?"
So I made the Mapper API.

In fact, I was inspired by the minimap when playing Ratchet:Deadlocked today.
I made this API with in mind the purpose of implementing a minimap in a game.
Theoretically, Mapper can map a character's current position to a minimap displayed on the HUD.


Before you use Mapper,
call this static method first: Mapper.init(stage);
since Mapper depends on the Stage instance.
Then you can use Mapper.addTracker() to map one numeric property to another through a custom relation.

Mapper.init(stage);
var mapper:Mapper = new Mapper();
mapper.addTracker(tracker, property, target, targetProperty, factor, scale, offset, preoffset);

After this mapper would maintain the following relationship:

tracker[property] = (target[targetProperty] + preoffset) * factor + offset;

Wednesday, April 23, 2008

Tile




View SWF online

Download FLA
Downlaod API


As its name suggests,
Tile tiles things,
and it can offset the tiles.

Tiling is an extremely common effect,
So I decided to create this API.

I tried to make this demo's graphics like that in Bioshock.
Don't those next-gen games always add a lot of glow effects of such kind?

Monday, April 21, 2008

Globe - DMF application




View SWF online

Download FLA


Okay, I cheated. I admit it.
It's not a perfect spherical transformation.
I was too lazy to generate a spherical displacement map by code.
So I simply drew an approximation of the displacement map.

And as for why there's no Antarctica on the globe,
it's because the world map I found clipped the top and the bottom from the complete map!!

Thursday, April 17, 2008

ZContainer Demo - Sakura




View SWF online
Download FLA
Download API
(ZContainer updated to v0.0.4)


I've enhanced the depth management mechanism's efficiency.
Note that theres a "pause" checkbox on the bottom left.
You can pause the animation and move the cursor around,
so as to clearly see the effect of depth.

ZContainer Demo - Atom




View SWF online
Download FLA
Download API


Yet another ZContainer demo.
This time I demonstrated its ability to dynamically adjust a DisplayObject's depth.
No special care is required to manage the depth of objects as in most of other similar examples.

ZContainer Demo - Tunnel




View SWF online
Download FLA
Download API


ZContainer is a 2.5D DisplayObjectContainer.
In addition to the ordinary x and y data,
ZContainer can hold information of depth for a DisplayObject.
And according to its camera's position,
the relative positions and scales of its children will be adjusted.
It can also add "ZOperations",
which is the effect that will be applied to objects that are to near or far from the camera.
ZOperations can be custom-extended from AbstractZOperation.

Saturday, April 5, 2008

Bunny dance anyone?





View animation


I've been always wanting to make my own Carammeldansen animation...and here it is!!
It took me HOURS to get it done.
Had it not been for a reference example, I guess I would have spent a whole week making this...

Hopy you like it, enjoy :)

P.S. Remember to turn on the speakers.

Thursday, April 3, 2008

Chaser "locked mode" Demo - Taipei 101




View SWF online
Download FLA
Download API


I made another demonstration of the use of Chaser's new "locked mode".

Next time, when you're lost in Taipei and asking me for direction.
Don't say something like "I can see Taipei 101 from here, so where am I?"
Sorry pal, can't help you. You can be anywhere in Taipei.

Wednesday, April 2, 2008

Chaser v1.0.2 - "locked mode" added




View SWF online
Download FLA
Download API


I've added the new "locked mode" in the Chaser API.
Though this effect can be achieved by using the existing ATTRACTIVE and DIRECT mode,
the new LOCKED mode is much more CPU-friendly for this simple effect.

Tuesday, April 1, 2008

Flash SWF contolling Flex SWF

I just got my serial number for Flex Builder 3 Educational Edition, cheers~

The first problem I encounter is, I have no idea how I can loader a Flex SWF into a Flash SWF through Loader and control it within the Flash SWF.

I ended up looking for answers on Google, and I found this: REFERENCE

Great, now I know every Flex SWF has two frames.
And the Flash SWF's root counterpart in Flex's SWF is application

So here's the general procedure:

1. Load a Flex SWF through a Loader object.
2. Use any utility to delay the code that accesses anything in the Flex SWF (like Timer or Tweener).
3. If there's a button called btn on the top level in the Flex SWF, I could reference it by typing loader.content.application.btn


Thanks a lot, Wim Vanhenden~