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 > Keeping track of one's position in mode7

#7980 - igorfromspb - Sun Jun 29, 2003 8:36 pm

Maybe this is a really stupid question, but I've never been good at math... Anyway, I've got the mode7 tutorial of the Pern Project up and running but I can't help wondering how one could keep track of one's position on the background map. In other words supposing the player's feet are at (120, 160) - at the bottom of the screen in the middle - how do I work out where his feet are on the background map, so that I could check if he can step on this or that tile?
I do appologise for such a silly question - I have tried to work this out myself before posting this here but I really am dumb at math. :-((((
_________________
Guns for show, knives for a pro

#8046 - sgeos - Tue Jul 01, 2003 6:22 am

igorfromspb wrote:
...I can't help wondering how one could keep track of one's position on the background map...


You should keep track of your critter in world coordinates. All of your display and internal calculations should be based on these world coordinates. You probably just need an X and a Y, maybe a Z, maybe a world number. (Think mario. World 3-2, etc...)

-Brendan