Original Post
Okay this is a simple work in progress. The progress has come to a halt because I cant figure out how to get the tilemap to scroll smoothly. Here is the relevant code. With the scroll plus the x and y its no longer smooth scrolling and when I use just the scroll it works but it no longer looks up my tiles. im not sure whats wrong exactly but help would be good. Thanks for looking.
void DrawTileMap(ID3DXSprite &mapsprite,int tiledimx,int tiledimy,RECT ▭,CGRAPHICS *anobject)
{
int numtilesx=20,numtilesy=15;
//are tiles power of 2
if(tiledimx/2!=0&&tiledimy/2!=0)
{
//Print tiles must be power of 2
}
//Load Level file using FILE I/O store in structure
//Draw Screen
for(int y=0;y<numtilesy+1;y++)
{
for(int x=0;x<numtilesx+1;x++)
{
//mapspritedraw();
int scrollx=worldx/tiledimx;
int scrolly=worldy/tiledimy;
offsety=scrolly & (tiledimy-1);
offsetx=scrollx & (tiledimx-1);
tilecoord.x=(x*tiledimx)-offsetx;
tilecoord.y=(y*tiledimy)-offsety;
//Problem maybe at this line????
TileLookUp(97,32,32,map[scrollx+x][scrolly+y],rect);
mapsprite.Draw(anobject->pTexture,▭,NULL, NULL, 0.0f,&tilecoord,0xffffffff);
}
}
}
[Edited by - abcdefg on April 20, 2005 10:43:16 PM]