Problems with tilemap and sprites

Hi, I’ve a tilemap with tiles of 32 pixels and sprites with different dimensions.

My problem is that sprites are overlapped to the tiles

i.e:

   A

BBBBBBBB

where

A is a sprite
and
B are tiles

The sprite is not above the tiles but overlapped to the tiles…

??? ??? ???

Well…so what’s the real problem here? Do u want your sprites to be on just one tile?

if I build a tilemap like this:

A
BBBBB

I want that the A sprite will be above the B tiles

If I build:

BBBA

I want that the A sprite will be immediately later the B tile and not overlapped to this last

I hope you understand me… if you want I can post the code

Hmm…i guess that then u must make a calculation of sprites position…though i still dont get it 100%…

True tile based games draw a line of tiles at a time, as each line represents a different Z depth. You star tat the top (furthest away in Z)

After you draw each lien fo tiles, you draw all sprites whose base is within the top and bottom of that row of tiles.

TANSTAAFL has written an excellent book onw riting siometric games. Its written using C code but its a straightfoward translation to Java.

http://www.amazon.com/gp/product/0761530894/104-5326079-5284734?v=glance&n=283155