void DrawTiles()
{
int TileC = (int)(ViewCenterX / TileW);
int TileR = (int)(ViewCenterY / TileH);
float OfsX = -(ViewCenterX - TileC*32);
float OfsY = -(ViewCenterY - TileR*32);
int TileCInit = TileC - 10;
int TileRInit = TileR - 8;
for(int col = 0; col < 21; col++)
{
for(int row = 0;row < 16; row++)
{
int YCoord = (int)(row*32 + OfsY);
int XCoord = (int)(col*32 + OfsX);
BlitTile(XCoord, YCoord, TileCInit+col, TileRInit +row);
}
}
}
Stopping my ViewCenter Camera!
Surely you'd just need to check to make sure the camera doesn't go any further from the edge of the map than (distance to center)?
Sorry, I know what I'm trying to say, but having trouble explaining what I mean tonight!
Sorry, I know what I'm trying to say, but having trouble explaining what I mean tonight!
void CheckCamera(){ int TileC = (int)((ViewCenterY - SHEIGHT/2)/32); int TileR = (int)((ViewCenterX - SWIDTH/2) /32); if((ViewCenterX + SWIDTH/2) <= (xPos + Wizzy_Width)) { ViewCenterX += 15; } if((ViewCenterX -SWIDTH/2) >= (xPos)) { ViewCenterX -= 15; } if((ViewCenterY + SHEIGHT/2) <= (yPos + Wizzy_Height)) { ViewCenterY += 15; } if((ViewCenterY - SHEIGHT/2) >= (yPos)) { ViewCenterY -= 15; } if(TileC < 0) { ViewCenterY += 15; }}
this is what i have and as you can see th TileC < 0 ...its workin but its a bit glitchy i didnt finish the rest of it... it does goto the border because i think it rounds it? so im not sure how to fix that....
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement