Skip to main content
gamedev.net
🔒 Locked

Tilemapping frustration

Started by LordKaT 0 replies 450+ views
Original Post
LordKaT
LordKaT
I got a tile mapping engine (well, borrowed) it uses Andre LaMothe's method (as per his book) with his BOB engine (I need to get around to making my own someday - although my engine does have modifications in it) Im able to go just about anywhere Out of Bounds (of the map) without the thing crashing (yay for me!) However, if I go OB on the X axis the tile's still get drawn (IE: whatever th last row is, that will be filled in as i go along) No problem on the Y axis Any ideas to get this to stop? ("world" is a 20x20 char.)
    
inline void TNW_Engine(void)
{
 int start_x, start_y;
 int end_x, end_y;
 int offset_x, offset_y;
 int texture_x, texture_y;
 start_x = world_x / 64;
 start_y = world_y / 64; 
 end_x = start_x + 9;
 end_y = start_y + 6;
 offset_x = -(world_x % 64);
 offset_y = -(world_y % 64);
 if (offset_x)
  end_x++;
 if (offset_y)
  end_y++;
 texture_x = offset_x;
 texture_y = offset_y;
 for (int y = start_y; y <= end_y; y++)
 {
  for (int x = start_x; x <= end_x; x++)
  {
    textures.x = texture_x;
    textures.y = texture_y;
    textures.curr_frame = world[y][x];
    if (textures.curr_frame != NULL)
      Draw_BOB(&textures,lpddsback);
    texture_x += TILE_SIZE;
  }
  texture_x = offset_x;
  texture_y += TILE_SIZE;
 }
}
    
Edited by - LordKaT on January 3, 2001 5:54:02 PM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.