I have a 2D world of 50*50meters and a viewport of 15*10meters.
Current situation:
if(player.x>World.WORLD_WIDTH){
player.x = 0;
}
if(player.x<0){
player.x = World.WORLD_WIDTH;
}
if(player.y>World.WORLD_HEIGHT){
player.y = 0;
}
if(player.y<0){
player.y = World.WORLD_HEIGHT;
}
So when the player will be placed on the other side of the world when he reaches the border. The camera is always oriented on the player which results in an ugly "jump" when the player is replaced on the other side.
How can i optimize my render-class to flewless render my world.
example:
The player is at location {0,0}. on the right the world should be rendered normal {0,0} - {7.5,0}. And on the left i want to show the other end of the world {-7.5,0} - {0,0}. Same for the Y axis.
I am shure this is a common questen and asked several times here, but i have not found anything with the searchterms "infinite world" or "repeating world".
any advices?