Advertisement

Map Looping

Started by January 01, 2001 06:45 PM
0 comments, last by LordKaT 24 years ago
Hi all, Im finally getting the hand of this directx/directdraw stuff (yaya for me!) Anyway The game Im working on is a top-down tles based rpg (compleatly 2d, nothing facy, i figure i better start off with something im halfway decent with and finish it). Im working on a "world map" (you know, sorta like final fantasy) where you can travel around the world (by foot, by air or by sea) but right now Im stuck. I can ''sorta'' get the map to loop by resetting the world_x and world_Y coordinates, however this isnt the effect im looking for. Im lookign for more of a smoothness.
  
inline void TNW_Engine(void)
{
	int index, index_x, index_y, start_map_x, start_map_y, end_map_x, end_map_y, offset_x, offset_y, texture_x, texture_y;
	start_map_x = world_x/64;
	start_map_y = world_y/64; 
	end_map_x = start_map_x + 10 - 1;
	end_map_y = start_map_y + 7 - 1;
	offset_x = -(world_x % 64);
	offset_y = -(world_y % 64);
	if (offset_x)
		end_map_x++;
	if (offset_y)
		end_map_y++;
	texture_x = offset_x;
	texture_y = offset_y;
	for (index_y = start_map_y; index_y <= end_map_y; index_y++)
	{
		for (index_x = start_map_x; index_x <= end_map_x; index_x++)
		{
			textures.x = texture_x;
			textures.y = texture_y;
			textures.curr_frame = world[index_y][index_x] - ''0'';
			Draw_BOB(&textures,lpddsback);
			texture_x += 64;
		}
		texture_x =  offset_x;
		texture_y += 64;
	}
}
  
so my problem is, that when I reach the end of the map, i want it to scroll smoothly, instead of a ''zelda'' type of transformation. --LordKaT
This is just an idea, so:

Instead of for (x ...) for (y ...) have something like:

index_y = 0;
index_x = 0;

while (on_map)
{
textures.x = texture_x;
textures.y = texture_y;
textures.curr_frame = world[index_y && map_width][index_x && map_width] - '0';
Draw_BOB(&textures,lpddsback);
texture_x += 64;
index_y++;
index_x++;
};

Or something... see what I'm getting at?

Edited by - morfe on January 1, 2001 9:05:43 PM
"NPCs will be inherited from the basic Entity class. They will be fully independent, and carry out their own lives oblivious to the world around them ... that is, until you set them on fire ..." -- Merrick

This topic is closed to new replies.

Advertisement