New tile based platform engine - part 7 - trampolines

After the AS3 translation of AS2 part 6, it’s time to introduce trampolines.

Just like ladders, trampolines have their rules. Here they are:

1 - A trampoline does not act like a wall, so a player can walk through it just like a cloud

2 - A trampoline should never be placed over another trampoline

3 - When you land on a trampoline, your vertical speed is inverted

How does this affect gameplay?

Just try to play and reach that unreachable platform as shown in the picture

Here it is the actionscript: Read more

New tile based platform engine - part 6 - ladders

It’s time to introduce ladders.

Ladders are quite hard to do for one reason: there is a lot of ways of intending ladders.

Can the player jump when on a ladder?

Should a ladder act as a hole if the player walks on it?

These are only two of the many questions you may ask about ladders.

So I have to made some rules:

1) Player climbs the ladder up and down using UP and DOWN arrows

2) Player can jump when on a ladder

3) If the player is falling and encounters a ladder, he will keep falling until he presses UP or DOWN

4) Player can climb a ladder if at least one of its corners is in the ladder Read more

New tile based platform engine - part 5 - clouds

You asked for the clouds, and here they are.

Clouds are marked with a 5 in level array.

Next stop… ladders… Read more

New tile based platform engine - part 4

For all jumping fanatics out there, I developed the jumping routine.

You can jump hitting SPACE, hope you like it.

From next post, I’ll start explaining how I developed this script and obviously I will add a lot of tile types.

Now I need some decent pixel art to give the game a polished look.

And don’t forget I am about to translate it into AS3… Read more

New tile based platform engine - part 3

In this 3rd step I introduced the gravity.

Now the hero starts on the top of the screen and he can walk “downhill” thanks to gravity.

During next step I’ll introduce jumps, then a massive explication will follow.

And AS3 version, of course.

I have to say, making a platform engine is funny and a little harder than I expected. Read more

New tile based platform engine - part 2

In the second part of the engine, I added boundary walls.

Still raw code at the moment, but you can see it in action here.

It’s the same thing as the one published in part 1, I just added walls and collisions.

One note… the hero now has its anchor point on its center, where in the previous example it was in the upper left corner Read more

New tile based platform engine - part 1

I am about to develop a tile based platform engine that (in my opinion) will allow to create a lot of different games just changing some parameters.

At the moment it only allows to move horizontally but everything is planned, from rooms to jumps, ladders and ropes.

My goal is making the developer only focus on level design.

The most interesting thing is I am developing both AS2 and AS3 versions of the engine.

The other platform engine I created some time ago is discontinued. This will be better.

In this first part, we have four tile types:

Ground: the normal ground, with a normal acceleration and friction

Ice: a slippery tire, with reduced acceleration and friction

Left and right treadmills: these tiles will increase/decrease your speed according to their arrow Read more

Create a Flash game like PixelField - part 3

This is the 3rd step of the creation of this awesome game.

In this step, I created a full playable game with 3 levels.

Level generation is made through a function and a switch that renders the proper level.

Full source code commented as usual, be sure to read part 2 before jumping into this one.

Now, it’s all about level design and adjusting parameters to create your own PixelField game.

This is the AS2 version, but if the game gets a good feedback (comments and votes) I’ll release the AS3 version too. Read more

Create a Flash game like PixelField - part 2

Here we are with the second part of Create a Flash game like PixelField.

In this step we’ll see how to draw a level.

The game is obviously a tile based one, and I like how tiles are a bit smaller than the real tile size, to leave a little gap between tiles and make a lighter layout.

Everything is explained in the source code, but it’s interesting to notice how lines 75-76 does the same thing as lines 39-46 of the previous script but satellite rotation seems delayed.

I also would like to thank Tony Pa (the author) for telling us friction and speed_scale values in order to make the gameplay close to the original game.

Another variable that can affect gameplay introduced in this version is satellite_distance, that determines the distance from the big square and the satellite.

Here it is the source code: Read more

Mouse avoider/Biggification remix prototype

Just a quick uncommented prototype involving growing (and moving) spheres and a sphere you control with the mouse.

Click the mouse to change color, if you touch a sphere of the same colour as yours, you'll make it disappear.

ACTIONSCRIPT:
  1. Mouse.hide();
  2. speed = 30;
  3. passed = 0;
  4. placed = 0;
  5. growth = 0.1;
  6. velocity = 5;
  7. player = _root.attachMovie("ball", "ball", _root.getNextHighestDepth());
  8. player.gotoAndStop(1);
  9. player.onEnterFrame = function() {
  10.     this._x = _root._xmouse;
  11.     this._y = _root._ymouse;
  12. };
  13. _root.onMouseDown = function() {
  14.     if (player._currentframe == player._totalframes) {
  15.         player.gotoAndStop(1);
  16.     } else {
  17.         player.gotoAndStop(player._currentframe+1);
  18.     }
  19. };
  20. _root.onEnterFrame = function() {
  21.     passed++;
  22.     if (passed>speed) {
  23.         passed = 0;
  24.         collect = _root.attachMovie("ball", "ball_"+placed, _root.getNextHighestDepth(), {_x:Math.random()*500, _y:Math.random()*500});
  25.         collect.gotoAndStop(Math.floor(Math.random()*collect._totalframes)+1);
  26.         collect.angle = Math.random()*6.28318531;
  27.         collect.xspeed = velocity*Math.cos(collect.angle);
  28.         collect.yspeed = velocity*Math.sin(collect.angle);
  29.         collect.onEnterFrame = function() {
  30.             this._width += growth;
  31.             this._height += growth;
  32.             this._x += this.xspeed;
  33.             this._y += this.yspeed;
  34.             x_dist = this._x-player._x;
  35.             y_dist = this._y-player._y;
  36.             if (this._x<0) {
  37.                 this._x = 0;
  38.                 this.xspeed *= -1;
  39.             }
  40.             if (this._x>500) {
  41.                 this._x = 500;
  42.                 this.xspeed *= -1
  43.             }
  44.             if (this._y<0) {
  45.                 this._y=0
  46.                 this.yspeed *=-1
  47.             }
  48.             if (this._y>500) {
  49.                 this._y=500
  50.                 this.yspeed *=-1
  51.             }
  52.             distance = x_dist*x_dist+y_dist*y_dist;
  53.             touch_distance = ((player._width+this._width)/2)*((player._width+this._width)/2);
  54.             if (distance<touch_distance) {
  55.                 if (this._currentframe == player._currentframe) {
  56.                     this.removeMovieClip();
  57.                 }
  58.             }
  59.         };
  60.     }
  61. };

Tell me if you have some good ideas to turn it into a game and I'll improve it as you want Read more

← Previous PageNext Page →