Creation of a platform game with Flash – step 1

November 3rd update: part 2 released.

Back from my holidays, here I come with a brand new tutorial serial.

This time I will talk about platform games.

“Platform game, or platformer, is a video game genre characterized by jumping to and from suspended platforms or over obstacles. It must be possible to control these jumps and to fall from platforms or miss jumps. The most common unifying element to these games is a jump button.”

This is the beginning of a very interesting article taken from Wikipedia.

I strongly recommend you to read it… all in all it’s a piece of our history.

I think we can develop interesting Flash platform games.

The very first step is introducing the level. I decided to code the level as a tile-based level, so you should read How to load levels in a Flash tile based game tutorial before all.

Level creation

In this example I am going to use the array method.

In the first frame write the actionscript:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
level = new Array();
_root.createEmptyMovieClip("lev", _root.getNextHighestDepth());
level[0] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
level[1] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[2] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[3] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[4] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[5] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1);
level[6] = new Array(1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[7] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[8] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[9] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[10] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[11] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[12] = new Array(1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[13] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[14] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
for (y=0; y<=14; y++) {
	for (x=0; x<=24; x++) {
		if (level[y][x] != 0) {
			place_brick = lev.attachMovie("block", "block_"+lev.getNextHighestDepth(), lev.getNextHighestDepth(), {_x:x*20+10, _y:y*20+10});
			place_brick.gotoAndStop(level[y][x]);
		}
	}
}

Line 1: Defining a new array called level that will contain the level data

Line 2: Creating a new empty movie clip that will contain the level

Lines 3-17: Populating the array with more arrays to design the level. We will have a zero for an empty spot or a one for a platform/wall

Lines 18-19: Loops that scan the entire array and sub-arrays

Lines 20-23: If the array at position (y,x) is different than zero (in this case it can only be one but this will be useful when we will introduce different types of platforms) then attach a movie previously created and linkaged as “block” in the right position according to y and x array position. The gotoAndStop instruction will be useful when we will have more platform tiles, one per frame in the same movieclip.

Now the level is complete, time to add the hero.

The Player

I linkaged another movieclip as player. In this first example, you should design your hero smaller than any other platform. We’ll see in further tutorials how this won’t be so important once the game engine will be finished, but at the moment it’s very important.

The new actionscript is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
yspeed = 0;
max_yspeed = 16;
gravity = 1;
level = new Array();
_root.createEmptyMovieClip("lev", _root.getNextHighestDepth());
level[0] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
level[1] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[2] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[3] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[4] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[5] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1);
level[6] = new Array(1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[7] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[8] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[9] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[10] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[11] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[12] = new Array(1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[13] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[14] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
for (y=0; y<=14; y++) {
	for (x=0; x<=24; x++) {
		if (level[y][x] != 0) {
			place_brick = lev.attachMovie("block", "block_"+lev.getNextHighestDepth(), lev.getNextHighestDepth(), {_x:x*20+10, _y:y*20+10});
			place_brick.gotoAndStop(level[y][x]);
		}
	}
}
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:40, _y:40});
player.onEnterFrame = function() {
	yspeed += gravity;
	if (yspeed>max_yspeed) {
		yspeed = max_yspeed;
	}
	while (_root.lev.hitTest(this._x, this._y+this._height/2-1+yspeed, true)) {
		yspeed--;
	}
	this._y += yspeed;
};

Line 1: Initializing yspeed variable at zero. This is the vertical speed of the player

Line 2: Initializing max_yspeed variable at 16. This is the maximum vertical speed of the player. You will know what I mean in a minute or two.

Line 3: Initializing gravity variable at 1. This represents the gravity of the game.

Here I have to make a consideration: there should be two types of platforms: one with a so called “gravity” and one without it.
If you make a platform game with gravity, when the player steps off a platform, he will start falling down at increasing speed, just like in the real world. If you make the game without gravity, when the player steps off a platform, he will simply “move down” at a constant speed.

If you want the player to fall down at an increasing speed, use a low gravity value and a high max_yspeed value, like in my example. You will have to put a limit to yspeed anyway for a playability reason.

If you want the player to fall down at a constant speed, use a mid gravity value, such as 4 or 5 and do the same for the max_yspeed value. In this case, I suggest to set both values equals to the walking speed you will learn later.

Line 29: Putting the player on the stage, in a high place. You may need to reload the page to watch him fall.

Line 30: Routine to be executed at every frame

Line 31: yspeed variable is increased by gravity value

Lines 32-34: Checking if yspeed value exceeds max_yspeed value and if true, set yspeed value to max_yspeed value

Lines 35-37: These are the core lines for gravity management. Look: I perform an hit test between the platforms and the “feet” of the player plus yspeed value. In other words, I forecast next player’s position as if there was no walls. Then, I check if there is a wall in that position. If there is a wall, I decrease yspeed value and repeat the whole operation.

This picture will explain how does it work.

Collisions

Line 38: Adding yspeed to _y position. As explained, yspeed can be zero if the player is already on a platform

Now we have a static player on the stage. Time to move him!

The moving player

We want now the player to move left and right

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
xspeed = 0;
yspeed = 0;
max_yspeed = 16;
gravity = 1;
walk_speed = 4;
level = new Array();
_root.createEmptyMovieClip("lev", _root.getNextHighestDepth());
level[0] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
level[1] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[2] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[3] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[4] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[5] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1);
level[6] = new Array(1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[7] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[8] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[9] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[10] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[11] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[12] = new Array(1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[13] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[14] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
for (y=0; y<=14; y++) {
	for (x=0; x<=24; x++) {
		if (level[y][x] != 0) {
			place_brick = lev.attachMovie("block", "block_"+lev.getNextHighestDepth(), lev.getNextHighestDepth(), {_x:x*20+10, _y:y*20+10});
			place_brick.gotoAndStop(level[y][x]);
		}
	}
}
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:40, _y:40});
player.onEnterFrame = function() {
	yspeed += gravity;
	if (yspeed>max_yspeed) {
		yspeed = max_yspeed;
	}
	if (Key.isDown(Key.LEFT)) {
		xspeed = -walk_speed;
	}
	if (Key.isDown(Key.RIGHT)) {
		xspeed = walk_speed;
	}
	while (_root.lev.hitTest(this._x, this._y+this._height/2-1+yspeed, true)) {
		yspeed--;
	}
	while (_root.lev.hitTest(this._x-this._width/2+1+xspeed, this._y, true)) {
		xspeed++;
	}
	while (_root.lev.hitTest(this._x+this._width/2-1+xspeed, this._y, true)) {
		xspeed--;
	}
	this._y += yspeed;
	this._x += xspeed;
	xspeed = 0;
};

Line 1: Defining xspeed in the same way yspeed was defined

Line 5: Initalizing walk_speed variable. This is the speed of the player when walking (later he will be able to run!)

Lines 37-39: If the left arrow key is pressed, then set xspeed to -walk_speed (the player will move to the left)

Lines 40-42: Same thing with the right key

Lines 46-51: Apllying the same principle seen when the player was falling to x and y movements. This time the “hot spot”, the point where the collision is checked, is on the left (or right) side of the player in the middle of his height. This will work fine now, but will require some adjustments when we will have a “real” player on the stage instead of a red box.

Line 53: Updating player x position according to xspeed

Line 54: Set xspeed to zero. If you don’t do that, the player won’t stop walking when you release the arrow key.

Now we have a player running! Time to make him jump

The jumping player

When we want to make a player jump, we need to know two things:

1) The player can jump only when he has his feet on the ground

2) The player has a head so he cannot jump through platforms (he will be able to jump through some special platforms, called “clouds”, in next tutorial)

We need too to decide if the player can change direction while in the air or not. This is your decision and will affect gameplay.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
xspeed = 0;
yspeed = 0;
max_yspeed = 16;
gravity = 1;
walk_speed = 4;
can_jump = false;
jump_power = 10;
jump_walk = true;
level = new Array();
_root.createEmptyMovieClip("lev", _root.getNextHighestDepth());
level[0] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
level[1] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[2] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[3] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[4] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[5] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1);
level[6] = new Array(1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[7] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[8] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[9] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[10] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[11] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[12] = new Array(1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[13] = new Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
level[14] = new Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
for (y=0; y<=14; y++) {
	for (x=0; x<=24; x++) {
		if (level[y][x] != 0) {
			place_brick = lev.attachMovie("block", "block_"+lev.getNextHighestDepth(), lev.getNextHighestDepth(), {_x:x*20+10, _y:y*20+10});
			place_brick.gotoAndStop(level[y][x]);
		}
	}
}
_root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:40, _y:40});
player.onEnterFrame = function() {
	if (Key.isDown(Key.LEFT)) {
		if (jump_walk or can_jump) {
			xspeed = -walk_speed;
		}
	}
	if (Key.isDown(Key.RIGHT)) {
		if (jump_walk or can_jump) {
			xspeed = walk_speed;
		}
	}
	if (Key.isDown(Key.SPACE) and can_jump) {
		yspeed -= jump_power;
		can_jump = false;
	}
	yspeed += gravity;
	if (yspeed>max_yspeed) {
		yspeed = max_yspeed;
	}
	while (_root.lev.hitTest(this._x, this._y+this._height/2-1+yspeed, true)) {
		yspeed--;
		can_jump = true;
	}
	while (_root.lev.hitTest(this._x-this._width/2+1+xspeed, this._y, true)) {
		xspeed++;
	}
	while (_root.lev.hitTest(this._x+this._width/2-1+xspeed, this._y, true)) {
		xspeed--;
	}
	while (_root.lev.hitTest(this._x, this._y-this._height/2+1+yspeed, true)) {
		yspeed++;
	}
	this._y += yspeed;
	this._x += xspeed;
	if (jump_walk or can_jump) {
		xspeed = 0;
	}
};

Line 6: Initializing can_jump variable to false. This variable determines if the player can jump or not.

Line 7: Initializing the jump power. The higher the value, the higher the jump

Line 8: Variable that determines if the player can change direction while jumping

Line 37: Additional control when the player presses the left key. Before changing the xspeed I check that the player can walk while jumping or can jump = is not jumping

Line 43: Same thing with the right key

Lines 46-49: If the player presses the jump button (in this case the spacebar) then subtract jump_speed to yspeed and, since the player now is jumping, set can_jump to false (you can jump while jumping).

Line 56: If the player has the feet on the ground, then he can jump

Lines 64-66: Collision test as explained before with the “head” of the player

Lines 69-71: xspeed is resetted to zero only if the player can walk while jumping or can jump = is not jumping

And this is the very primitive first result. It has some glitches because player hot spots aren’t fully defined. In next tutorial we will learn how to insert a real player and everything will work fine.

Download the source codes of this tutorial, experiment and give me feedback

Then, move to part 2.

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (41 votes, average: 4.49 out of 5)
Loading ... Loading ...
Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 59 comments

  1. 0mega

    on July 3, 2007 at 11:13 am

    excellent tutorial thanks (runs of to make a platformer)

    (NOTE: added a link in the website bit for you you might wanna check it out)

  2. eblup

    on July 3, 2007 at 12:21 pm

    hey did you already do this?

    o well still good and helped me find an error in my codeing of my style of jumping.

    ares are veary simmilar.

  3. Mousey

    on July 3, 2007 at 5:04 pm

    amazing, as always !!

  4. Jerm

    on July 3, 2007 at 7:14 pm

    cool, I just had to change a little bit of stuff for flash mx

  5. And Mar

    on July 5, 2007 at 4:10 am

    If I jump while I’m just under the right edge of the first platform, and I hold down space, the player flies off the screen because of continous jumping.

  6. eblup

    on July 6, 2007 at 9:00 am

    hey wooow nice error you found

    And Mar

    i think it may be caused by the xspeed– and xspeed
    mixed with he has if not on ground grav increese.

    so if you move under it while gumping at the right position it will send you to the other side of the block and durring that it keeps him in the block while aadding jump power and makes him fly up

  7. sam

    on July 13, 2007 at 9:20 am

    or it could be because if hes on the ground, he can jump again and since hes going threw the platform, hes continuously hitting it, causing him to continuously jump…. keep up the good work…

  8. sam

    on July 13, 2007 at 9:23 am

    also i had no idea you can use “and” rather than “&&” and “or” instead of ||

  9. lol

    on July 17, 2007 at 1:37 am

    u can jump in the air if u fall off a platform lol

  10. flash noob

    on August 6, 2007 at 3:23 am

    thx, your the first one with a platforming tutorial that acually worked for me :)

  11. emanueleferonato-fan

    on August 13, 2007 at 8:26 am

    wow it worked thx alot XD
    by the way whens part 2 comin out?

  12. Jamie

    on August 22, 2007 at 1:37 am

    awesome tutorial emanuele!

    some suggestions for next time:
    sloping tiles
    ladders
    pick-ups (coins, health, etc)
    enemies
    doors – to switch from screen to screen (like the zelda games)

    =D

  13. Nabz

    on September 16, 2007 at 5:45 am

    When’s the next one coming oooutt?

  14. squeenburg

    on September 23, 2007 at 7:13 pm

    yippee!
    i have been looking for something just like this.
    ill constaantly be checking for your next tutorial,
    but until then, im going to try to do stuff by guess and check.
    i think i know how, but i have never been good at doing things right,so at least ill try.
    PLZ MAKE THE NEXT ONE SOON!

  15. games » Creation of a platform game with Flash - step 1 : Emanuele Feronato - blog of an italian geek

    on October 9, 2007 at 11:22 am

    [...] Check it out! While looking through the blogosphere we stumbled on an interesting post today.Here’s a quick excerpt [...]

  16. Hello!

    on October 11, 2007 at 7:47 pm

    Hello, I am new at making flash games and your website has helped me a lot at making games, TY!!!!!!!!
    I really like this concept of platform gaming.
    Can you make the next tut soon, plz?

  17. Creation of a platform game with Flash - step 2 : Emanuele Feronato - italian geek and PROgrammer

    on November 3, 2007 at 4:41 pm

    [...] This is a quick update to the tutorial/engine started with Creation of a platform game with Flash – step 1. [...]

  18. miff

    on November 4, 2007 at 1:45 am

    Great!
    Any chance to write tut for swap tile games, like
    The Treasures Of Montezuma? I stuck in a selection and swap function.

  19. Sam

    on November 7, 2007 at 3:48 pm

    When will the second part be released???

  20. Emanuele Feronato

    on November 7, 2007 at 4:01 pm

    It’s already out, but I forgot to put the link.
    Now you’ll find the link at the beginning and the end of this post

  21. steff

    on January 16, 2008 at 5:34 pm

    wut did u change for mx?

  22. Creation of a platform game with Flash - step 3 : Emanuele Feronato - italian geek and PROgrammer

    on March 19, 2008 at 8:26 pm

    [...] parts 1 and 2 if you don’t remember what I am talking [...]

  23. Flashycool

    on March 22, 2008 at 3:41 am

    why doesn’t mine work? source code:
    http://www.freewebs.com/flashycool/TilePlatformer.fla

  24. Tommy

    on April 17, 2008 at 6:52 pm

    I was just trying to do a vry simple thing using the hittesting code and I came across a problem when I try to attachMovie. It just doesn’t appear, I checked my code against your source code and I can’t see what is wrong with it.

  25. Tommy

    on April 17, 2008 at 7:00 pm

    I have attached a link to a very simple file with merealy an attachMovie thing which also does not work although it is only up for a week where I uploaded it.

    http://senduit.com/9d38d3

  26. Tommy

    on April 17, 2008 at 7:11 pm

    I just found that right clicking on the movieclip and doing the linkage thing makes them appear. Should that be necessary?

  27. Tommy

    on April 17, 2008 at 7:52 pm

    oh dear found another problem the same as flashcool’s which is that the hitTest isn’t working

  28. jebus

    on May 11, 2008 at 2:25 pm

    i copied it all into the action script panel but when i pressed ctrl+enter, nothing comes up!

    plz help me!

  29. Creación de un juego de plataformas (tipo Mario) en Flash « Shift F12

    on May 12, 2008 at 6:16 pm

    [...] otro lado esta el tutorial de Emanuele Feronato (tambien para AS2). Parte 1 y Parte 2. Lo padre de este tutorial es que maneja varios niveles de [...]

  30. stevieb

    on June 5, 2008 at 2:02 pm

    Yo emanuelle! yo dude how u make different types of platforms! plz write back mon u so cool!

  31. brart

    on June 12, 2008 at 9:05 pm

    I made an as 3.0 version and send to emanuel

  32. brart

    on June 13, 2008 at 7:38 pm

    and here is the link

    http://www.triquitips.com/viewtopic.php?f=26&t=428

  33. Step by step AS3 translation of Creation of a platform game with Flash - step 1 : Emanuele Feronato - italian geek and PROgrammer

    on June 14, 2008 at 10:51 am

    [...] we’ll see how Bart de Boer translated Creation of a platform game with Flash – step 1 into [...]

  34. marc0

    on July 26, 2008 at 4:46 am

    im on the first example, but i cant get mine going… what is attached to “lev” on line 2? this might be my problem.

    thanks in advance.

  35. New tile based platform engine - part 1 : Emanuele Feronato

    on September 15, 2008 at 5:05 pm

    [...] other platform engine I created some time ago is discontinued. This will be [...]

  36. Christo

    on October 7, 2008 at 5:08 pm

    Hello ? Hell did this thing go or what ?

  37. Christo

    on October 7, 2008 at 5:10 pm

    How can I contact you Emanuele? I believe my email could not go through to you, I would really like your help.

  38. FlashDev

    on November 2, 2008 at 11:51 am

    There is mega glitch. There is a certain spot where if you jump your player speeds out of the top of the screen.

    Great tutorial so far otherwise.

  39. Blake

    on January 28, 2009 at 6:23 am

    i keep getting an error at the beginning that says “the class or interface brick cannot be loaded” and it points to my stop(); command in my brick movie clip. any ideas why this happens?

  40. Blake

    on January 28, 2009 at 6:28 am

    oh, haha i’m an r-tard. it’s because I had the block set up as brick, which is used in your level loading tutorial

  41. Interesting Links: That might be useful « s3rajkarnikar’s Weblog: College HND

    on May 1, 2009 at 5:00 pm

    [...] http://www.emanueleferonato.com/2007/07/03/creation-of-a-platform-game-with-flash-step-1/ [...]

  42. Balla

    on May 11, 2009 at 2:59 am

    You could have made that game with much easier codes

  43. shyfry

    on June 3, 2009 at 5:41 am

    cool tut ty

  44. Zavash

    on June 23, 2009 at 2:18 am

    Thank you sooo much Emanuele, your tutorial help me a lot!
    I love you haha!

  45. Zavash

    on June 23, 2009 at 2:28 am

    (“I love you haha!”) if you are female btw, haha.

  46. Platform engine using Box2D : Emanuele Feronato

    on July 6, 2009 at 11:45 pm

    [...] engines always represented a challenge for me, you can see my prototypes with AS2 and AS3, and this time I am going to make one using [...]

  47. Flash Platform Games - Graphic Design Forums | Website Design Forums (UK)

    on August 5, 2009 at 4:29 pm

    [...] How to make Mario/Zelda style games with flash! Tile based games Creation of a platform game with Flash – step 1 : Emanuele Feronato gotoAndPlay Flash Tutorials — Game creation tutorial Tile based [...]

  48. Flash Platform Games - Graphic Design Forums and Website Design Forums (UK)

    on August 25, 2009 at 1:36 pm

    [...] How to make Mario/Zelda style games with flash! Tile based games Creation of a platform game with Flash – step 1 : Emanuele Feronato gotoAndPlay Flash Tutorials — Game creation [...]

  49. Alexandra

    on November 18, 2009 at 10:56 pm

    Do you know how to make it so the platforms are solid so you can jump up onto them as this is exactly how I want me game to be although I don’t get how to make any of it Please can you explain exactly how to do it to me
    Thanks
    Please reply as soon as possible

  50. blinger2468 (utube)

    on February 28, 2010 at 4:42 pm

    omg u seriously did it the hard way!!!

  51. blinger2468 (utube)

    on February 28, 2010 at 4:43 pm

    u could do it in just a few actionscripts

  52. Xyfa

    on September 18, 2010 at 5:36 pm

    very nice tutorial however, using this method, the level is on top of my level complete screen.

    Any ideas?

  53. hazzasnake

    on December 12, 2010 at 11:03 pm

    can someone help me because when I try making the level I only get 2 blocks appear on my screen and it doesn’t make the layout typed in the array

  54. fair

    on December 23, 2010 at 7:32 pm

    i cant seem to get the stage to build…. what do you mean by “movie”?

  55. Flash in the Can 2011 Writeup - JonnyReeves.co.uk

    on March 10, 2011 at 7:33 pm

    [...] The game featured an “Infinite Grid” of streets.  This was achieved by creating a single cross-road grid block and then stamping it down to create a map.  The track was created by adding “crash barriers” to two of the Block’s exists, forcing the player down a pre-defined route.  The track was defined as an Array in the code, in a similar way that 2D Platform games would. [...]

  56. niyarbro789

    on July 5, 2011 at 5:23 am

    im tryin to get this code for the player. when i put the code in for the movie clip ‘player’ an error pops up saying: “Statement must appear within on handler.” what is that? im using ‘Sothink SWF Quicker’. the level code works with ‘Sothink SWF Quicker’, but not the player code.

  57. Chris Kimmel

    on July 20, 2011 at 7:01 pm

    Excellent tutorial. However, the character can have a corner in a wall and the engine won’t notice. Perhaps it could be solved by using 8 point to check instead of one:

    Points = +
    Else = .

    .+….+.
    +……+
    ……..
    ……..
    ……..
    ……..
    +……+
    .+….+.

    That would really minimize the problems.

  58. Chris Kimmel

    on July 20, 2011 at 7:06 pm

    Doh!

    My textart got screwed up. Here: If the character is a rectangle from the coordinates 1,1 to 10,20, there would be a point for hit testing at 2,1 & 1,2 & 9,1 & 10,2 & 1,19 & 2, 20 * 9,20 & 10,19.

    I’ll leave the visual up to you. :P

  59. Packapunch

    on October 2, 2011 at 1:42 am

    It’s nice, but how do you animate the player, so that when he walks, the player has a walking animation while moving?