gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Map Setting

#5049 - Maverick - Fri Apr 18, 2003 12:58 pm

There are games like zelda etc that dont change the map background until you have hit the end of the first map. They would probably do this by an:

Code:

if (sprite pos > screen width)
{
  load next map
  move sprite to the starting position
}


But there are also games like pokemon etc that have all of the maps loaded next to each other and there doesnt seem to be any changeover.

Are there any opinions on how this would be done?

#5052 - Daikath - Fri Apr 18, 2003 4:35 pm

You change the map in real time.

If you use the wrapping option with background if you get to the end of a map whether it is up, down, left or right. You will get to the other side, kinda like if you try to get to the ends of the earth.

But if you change the map when a player keeps nearing the end of a map and the program loads new tiles there to make the world seem continues the player will think that he is still walking into that direction.
_________________
?There are no stupid questions but there are a LOT of inquisitive idiots.?

#5054 - Lord Graga - Fri Apr 18, 2003 5:18 pm

You could make all the maps in 2D arrays, that would be 100 times easier than 1D.

#5058 - sgeos - Fri Apr 18, 2003 6:01 pm

[quote="Lord Graga"]You could make all the maps in 2D arrays, that would be 100 times easier than 1D.[/quote]

Until you figure out the math for arrays, yes. After you figure out the math for arrays, and get used to it it boils down to personal preference.

-Brendan