I am making my first game using the J2ME platform and have a question about collision detection. The game is a "super Mario" game which uses a TiledLayer to draw the "world".

Basically I need to figure out a way of detecting when the "Mario" sprite the user plays with lands on the ground, a hill or another item (represented by the TiledLayer).

Take a look at these two images to understand better what I am trying to explain:

Image 1:

Image 2:

Currently to determine whether Mario has landed on the ground or another item I use the following code:

if(MarioCanvas.marioSprite.collidesWith(MarioCanva s.gameLevel, false)) {
// ...Note: MarioCanvas.gameLevel is the TiledLayer

It works to a certain degree, however as you can see from Image 1, Mario can land on the lower "hill" walk off it and float as the sprite is colliding with the taller hill behind it.

What I ideally want is a method to determine if the sprite has landed on a particular vector/line (between two points) as illustrated in Image 2 with the yellow lines. This way would work much nicer than simply detecting if Mario has collided with a tile in the TiledLayer.

Is there a way to do this?