Advertisement

Tiles with HEIGHT are impossible ! Help me !

Started by March 22, 2001 04:07 AM
1 comment, last by MisterByte 23 years, 10 months ago
Ok, because I am german it is very difficult for me to explain what I want. I hope you understand my question ! I have programmed a Tile-Engine. The size of one tile is 64x32 (I think it is a good size, because you can shift!). My Engine renders all tiles to screen in the order from left to right and top to bottom ! Now I want render heigher tiles, too ! For Example 64x100. My Engine is multilayerd, that means, that on each tile-position it is able to draw more than one tile ! For all the ground I use the same tile-size (64x32). But now I want to draw over the ground a 64x100 wall ! For each tile-position I use the right-bottom corner as handle-position, because you can easy calculate the draw position if you have different heights ! // Example (Pseudo-Code) // The handle position is the right-bottom corner X = handlePosX - tilesizeX - 1 Y = handlePosY - HEIGHT - 1 Now I draw 2 tiles. First a grass-ground-tile with NO HEIGHT. Then a wall-tile with a HEIGHT of 100 on the grass-tile ground. (the wall has the same width as the ground) handlePosX = 200 handlePosY = 200 //First the grass (64x32) HEIGHT = 32 // If the height equals 32 then // the tile is flat ! tilesizeX = 64 X = handlePosX - 64 - 1 = 135 Y = handlePosY - 32 - 1 = 167 //First the grass (64x32) HEIGHT = 32 // If the height equals 32 then // the tile is flat ! tilesizeX = 64 X = handlePosX - 64 - 1 = 135 Y = handlePosY - 32 - 1 = 167 //...Then the wall HEIGHT = 100 tilesizeX = 64 X = handlePosX - 64 - 1 = 135 Y = handlePosY - 100 - 1 = 99 ...this works !! But now my question: In my engine I use smooth-scrolling. Not the whole map is blittet to the screen ! Only the tiles which should visible are blittet on screen. But what happens If a tile with a height of 100 is invisible and becomes visible in the next scrollstep ?? Then the large wall appears in one step, not in small smooth pixelsteps ! If I scroll from bottom to top, then there is no problem, because the start of the tile is on bottom, too ! If I scroll from left to right or from right to left there is NO problem, because the width of one wall equals the width of one ground-tile ! If I scroll from TOP to BOTTOM, then I have the problem that the wall-tile appears in one step ! What can I do ?? Have you an Idea (I hope you understand what i have really bad explained) Thank you very much MisterByte (perfect English languange Master)
I understand your problem.

What is the maximum height value for a tile? Maybe you can just use a bigger back surface? One that has a large Y value.

back surface height = viewport Y + max tile Z height

Would this solve the problem?
Advertisement
Pyabo : That''s one solution.

MisterByte : Another one would be to clip the bitmap to draw to
the screen space. That isn''t too hard (just some
adds and subs) but dependent on how you store your
bitmaps and which functions you use to draw them,
it could hit your performance... you''ll have to try.
As long as you don''t draw thousands and thousands of
bitmaps

Metron
----------------------------------------http://www.sidema.be----------------------------------------

This topic is closed to new replies.

Advertisement