Sign up ×

I've been putting together, albeit slowly, a traditional style game engine in flash/AS3 along the lines of Alundra/Final Fantasy 3/etc etc..

Everything so far is working smoothly (maps from XML data, collision, animation, etc) but I am having trouble gaining height/jumping.

See the image from Alundra to understand the style I am talking about: enter image description here

I would like for platforms to be jumped on. I am trying to brainstorm different ways to approach this. The player can obviously jump and move at the same time, so every tile would need a 'height' property I'm guessing, and vertical collision would be checked against the tile's height?

Are there any resources/tutorials or even starting points around this that people would like to share? Someone suggested a graph - see the last forum post here

share|improve this question

1 Answer 1

up vote 6 down vote accepted

If I were to do this game, I'd approach it like this:

  1. When designing the sprites I'd give each sprite that represents a part of the map a certain height value

  2. When the character collides with a plane, if the difference in height is equal to 5 then the character can walk on that plane.

  3. The maximum height of jump is 9, so for example if the player tries to jump from ground (height 0) to the stairs (height 10) they won't be able to do that.

  4. The red surfaces: either make the character fall down to the next plane (if you want the character to have the ability to fall) or don't allow the character to walk over them (I have set a very high value of 100 so that character can neither jump or walk on those walls).

As for the problem of jumping, as I mentioned, I gave the max height a value of 9. The character coordinates should be assigned like this:

 // Whatever value of x that you assign when you move it  
 charMC.x = x;  
 // The y value should be equal to the actual y position minus how far
 // the character is off the ground
 charMC.y = y - jumpHeight;
share|improve this answer
I find it unlikely that the sprites are in those shapes. More likely they are square tiles that are not so easily split. For example, the top left bit of the stairs (20 in your image) is probably on the same tile as the wall above them. In which case you'd be able to walk over it without jumping (because the top area is 25). I could be wrong about the tiles though. –  Richard Marskell - Drackir Dec 4 '11 at 15:58
Awesome first post! So you would just have an extra 2d data array on top basically? –  Chris Dec 4 '11 at 22:31
@Drackir By analyzing the image which was posted in the question, I assumed that the tiles collisions boxes are either square or have a specified degree of slope (take a look at the stairs). Also, you should be able to walk over sprites that are 5 steps higher than you (point #2) –  firemeaway Dec 4 '11 at 22:57
@Chris Thanks! A 2d data array describing the whole map is a great approach (it's even used in 3D games) –  firemeaway Dec 4 '11 at 22:59

Your Answer


