Get the full commented source code of

HTML5 Suika Watermelon Game

Talking about GearTaker game, Actionscript 2, Flash and Game development.

Do you know Tony Pa‘s GearTaker game?

GearTaker

You have a buddy jumping around rotating gears. As most Tony Pa’s games, it’s easier to play than to explain, and it’s hard to link… from this page select “GearTaker” and play.

I made a Flash prototype using two objects, the cog and the hero

The prototype has the following features:

1) Commented code
2) (virtually) unlimited fully customizable gears
3) Player starting gear and offset

Do you want more?

The only feature I am not showing you at the moment is how to determine the angle offset when the hero jumps from a cog to another. In my prototype, the hero always places himself at the top of the gear.

Also, if the hero files out of the stage, you’ll have to reload the page.

Can you improve the prototype?

// constant to convert degrees to radians
degrees_to_radians = 0.0174532925;
// constant to convert radians to degrees
radians_to_degrees = 57.2957795;
// arrays storing cogs information: x position, y position and diameter
cog_x_position = Array(100, 400);
cog_y_position = Array(200, 200);
cog_diameter = Array(100, 100);
// diameter of the hero
hero_diameter = 24;
// speed of the hero, when he'll fly
hero_speed = 5;
// flag to determine if the hero has to rotate attached to the cog (true) or not (false)
rotate = true;
// cog where the hero will rotate. The starting one
cog_to_rotate = 0;
// offset to align the hero to the top of the inner circle of the cog
angle_offset = -Math.PI/2;
// cycle scanning through all cogs
for (x=0; x

Mouse button to play. Happy jumping. Yes, this is a one-button game, and I have a next-to-be-published incredible game based upon this prototype.

Prototypes are the most interesting ways to make a game, remember what I was able to make from this to this...

And this is the source code, just in case you need it...

Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.