I have a background image - a seamless repeated texture.
I increment the xy coordinates of the texture every game cycle to animate it. It gives a nice parallax sky effect.
This texture is drawn on "viewWindow", a view with a fixed center.
I have a player sprite. This sprite moves (6, 0) to the right or (-6, 0) to the left of the screen.
I have a "viewWorld" that always centers on the player sprite. The player sprite is drawn in this view.
Here's the problem:
When the player moves right, the background image no longer moves on the x axis. It looks like it's just going up where as it should be going up AND left. And when the player moves left, the background image looks like it's going twice as fast on the x axis.
To explain it in another way:
When the player is still, the background moves (-1, -1). I want it to always move like this.
But when the player goes right, the background looks like it's moving (0, 1); and when the player goes left, the background looks like it's moving (2, 1).
Can anybody explain why this is happening and how I can fix this? It makes no sense to me because the background image and the player image is on different sf::Views.