Hey, Ive been developing an iso engine for the last few weeks, and everything works nicely, even the scrolling when working with a few limitations... Im writing this at 2am, so hopefully it''ll make sense... currently my engine (unoptimized) works like this:
I have a scrolling amount called "sx" and "sy", this amount gets incremented by a certain number when the key is pressed, so what I do is calculate the appropiate position in the map''s 2D array.. (my tiles are 64x32 iso).. so to get the position on the array all I do is:
xpos = sx / 64;
then I use xpos as the starting point in the drawing loop, like this:
for (h=ypos; h < ypos + NumOfVerticalTilesOnScreen; h++)
{
for (w=xpos; w < xpos + NumOfHorizontalTilesOnScreen; w++)
{
// calculate the tile''s position on the screen and
// draw it, no problem here, I think...
}
}
I only did this to optimize the map drawing a bit, instead of drawing the entire map, I just draw what''s on the screen.
well, that works great, except for one tiny detail, see, in my engine, I allow tiles of different sizes to be placed on the above layers (except the base layer), so, if I have a large tile that scrolls off to the left of the screen, it''ll disappear, so I figured I''d fix this by adding a couple of extra tiles to be drawn off-screen, which works ok, except that it introduces some weird scrolling errors, like sometimes it''ll scroll 3 or 4 tiles at once.. so after trying many to fix it for a LONG time, Ive reached the conclusion that maybe my whole approach is off..
So, I wanted to know what would be the best way to make the map scroll without scrolling errors or "jerking" while still allowing my tiles on the above layers to be of different sizes (it''s ok if I have to limit the size of the tiles on the top layers, I just dont want them to be necesarilly the same size as the base layer tiles).
oh, and Ive already read all the tutorials on scrolling Ive found, but none of them have helped me in this regard, however, they did get me this far.
If this didnt make sense let me know and I''ll make it a bit cleaner when Im a bit more awake... Thanks!
VisualLR
visual@guate.net
Luis Sempe
visual@guate.net
http://www.geocities.com/SiliconValley/6276