I’m making a platformer, with tile based map (like a lot of people). I begin in video games’s developing so it’s a little hard. I wan’t to learn by myself but on this problem I’m stuck .
My maps are made with a list like this :
mapList[x][y] = tile
With this list, I can loop on all the Tiles and draw them.
What I want to do is to “Loop” (repeat) the map. I mean, when the character reach the right limit (or left), the map repeats. I don’t understand how to do this, I search all the forums and all the question, but I found nothing 🙁
I don’t know if I’m making myself clear but English is not my best language and i’m sorry for this :p.
Thanks in advance for trying to help me or just for reading my issue.
When you have a grid that is WxH cells, the valid ranges for X are 0..W-1
So as a first approach :
but you’ll also need something for prevX (X-1) and maybe for X+d where d can be positive or negative.
You don’t want to mess with the modulo of negative numbers, so