More advanced landscape in a 2D sidescroller

to be more exact diagonal tiles.

by now I just have a engine which is like 2D sidescrolling but you cannot go up or down… unless you jump

you can just walk on a flat surface

This is due to the fact that I check “if player walks, would he collide with a tile? if so you cannot walk any further”
so in some way I would have to make sure you can go up/down diagonal landscapes

my question: what is the general approach to this kind of problem, using tile sprites ?

hmmm when you say diagonal tiles is it square that are rotated by 45 degree? If yes, you could just unrotate your map to do the collision. It’s easy to detect the collision against rectangle.

I did it and stuff

just to explain if anyway wants to know

I’ve done tiles to indicate a change oh height in the landscape like this:

http://img66.imageshack.us/img66/6985/88301730.png

and when I load the map I would scan for “those” tiles and insert a awt.Polygon at those points

and yeah… the player collides (intersects()) with the polygon and is push above the polygon before rendering.
for down, my gravity engine takes natural effect

You can have geometric tiles of any slope or curvature if you’ve got an acceptable collision algorithm. What usually works for me is just pushing the player up on top of whatever they’re standing on. So say you’re moving to the right, and that’ll put you inside a hill, just push the player upwards until they’re standing on top of the hill. Then if you need to push them too far that means it’s a wall. This method isn’t at all perfect but can usually work for platformers.

Alternatively you can just use something like Phys2D or Box2D.