If iI were to do this game, I'd approach it like this:
- When designing the sprites I'd give each sprite that represents a part of the map a certain height value (take a look at the image for details) http://imageshack.us/photo/my-images/27/heightmapx.png
When designing the sprites I'd give each sprite that represents a part of the map a certain height value
- When the character collides with a plane, if the difference in height is equal to 5 then the character can walk on that plane.
When the character collides with a plane, if the difference in height is equal to 5 then the character can walk on that plane.
- 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.
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.
- 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).
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 uyou move it charMC.x=x;x = x; // The y value should be equal to the actual y position minus how far // the character is off the ground charMC.y=yy = y - jumpHeight; http://imageshack.us/photo/my-images/27/heightmapx.png/
Hopefully this answers your question :)