Hey everybody, got an isometric routine here that doesn’t quite work perfectly. It seems to work fine scrolling horizontally, but when scrolling vertically, at some locations the tiles “jump” around to incorrect map coordinates.
Here is the suspect code:
//map coords
int mapX;
int mapY;
//offsets for smooth scrolling
int offsetX;
int offsetY;
//determine tiles to draw
//(drawX and drawY are arguments used to tell the routine
//which part of the map to draw.)
mapX = (int)(drawX / 64);
mapY = (int)(drawY / 32);
//figure offsets
offsetX = drawX & 63;
offsetY = drawY & 31;
for (i=0; i<SCREEN_WIDTH_TILES; i++) {
for (j=0; j<SCREEN_HEIGHT_TILES; j++) {
drawTile(mapX + j + ((mapY & 1) & (i & 1)), mapY + i,
j*64 - offsetX + ((i & 1)*32), i*16 - offsetY);
}
}
I’ve always had trouble with isometric, but I’m hoping this time I’ll finally get it running properly. Thanks for any and all help on this.