Hi!
I have some problems using some 2D-Side-Scrolling-Stuff.
I have a playfield of 1920x480 pixel.
I have a player object you can control using the cursor keys.
If the player hits the right edge (>1920), then he comes in at the left side. If the playe hits the left edge (<0), then he "jumps" to the right edge.
No I want to code a dynamic scroll engine who looks for the players position and scrolls until the screen have the correct coordinates so the player appears on the screen.
I dont know how to calculate the right x Coordinates for the background (so that I know where to scroll to).
If this works, I probably have another problem.
If the Players X-Coordinate is for example 10 and the X Value of the background is also 10.
Then the Players moves left. When the X Value becomes samler than 0, I will add 1920 to the x value, so the player jumps on the right side.
The Scroll Engine will recognize this and scrolls trough the whole world (from X=10 to X=1920).
But I want the Scroll Engine to scroll to the left. Because at X=1920 the screen looks the same as on X=0.
I hope you know what I mean.
I have some problems using some 2D-Side-Scrolling-Stuff.
I have a playfield of 1920x480 pixel.
I have a player object you can control using the cursor keys.
If the player hits the right edge (>1920), then he comes in at the left side. If the playe hits the left edge (<0), then he "jumps" to the right edge.
No I want to code a dynamic scroll engine who looks for the players position and scrolls until the screen have the correct coordinates so the player appears on the screen.
I dont know how to calculate the right x Coordinates for the background (so that I know where to scroll to).
If this works, I probably have another problem.
If the Players X-Coordinate is for example 10 and the X Value of the background is also 10.
Then the Players moves left. When the X Value becomes samler than 0, I will add 1920 to the x value, so the player jumps on the right side.
The Scroll Engine will recognize this and scrolls trough the whole world (from X=10 to X=1920).
But I want the Scroll Engine to scroll to the left. Because at X=1920 the screen looks the same as on X=0.
I hope you know what I mean.