-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
I am wrapping my hero horizontally, and there seems to be an issue when the world is bigger than the game/camera width.
The hero spawns in the middle of a 1000 x 500 world in a 500 x 500 game. When the hero leaves the world on the left, all is fine because 0 in the game/camera and 0 in the world are at the same point. However, as you move the hero to the right, you can see when the camera starts following the hero that the _currentBounds show the position in relation to the camera, not the world. This causes an issue when leaving the right side of the world because the numbers do not match up.
So, there are two possible reasons this isn't working, I believe:
- The sprite.getBounds() call in World.js is a Pixi specific function, so it is supposed to return the rendering coordinates, not the world coordinates. If that's the case, then a different function should be used in the World.wrap() function to get the bounds.
- There is a bug with the Pixi getBounds() function... but I don't think that is the case, as the concept of a world is unique to Phaser, and not part of Pixi.
Please look at the demo and let me know your thoughts. Perhaps some sort of camera offset has to be factored into the world wrap logic somehow. Thanks!