|
|
Okay I really can not figure out whats wrong here but my tiles are not smooth scrolling and I really cant figure this out. Anyone have anything similiar? I need some advice on what im missing. The screen keeps going back to the center after I scroll like one tile. Any ideas?
void DrawTileMap(ID3DXSprite &mapsprite,int tiledimx,int tiledimy,RECT &rect,CGRAPHICS *anobject)
{
//Load Level file using FILE I/O store in structure
int scrollx=worldx/tiledimx;
int scrolly=worldy/tiledimy;
int offsetx=worldx % tiledimx;
int offsety=worldy % tiledimy;
//Draw Screen
for(int y=0;y<numtilesy+1;y++)
{
for(int x=0;x<numtilesx+1;x++)
{
tilecoord.x=(x*tiledimx)-offsetx;
tilecoord.y=(y*tiledimy)-offsety;
char tile=map[y][x];
//I Assume tilelookup is working right
TileLookUp(97,32,32,tile,rect);
mapsprite.Draw(anobject->pTexture,&rect,NULL, NULL, 0.0f,&tilecoord,0xffffffff);
}
}
}
|
|