You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
This is now fixed. It's not perfect because if you use an offset anchor it doesn't take that into consideration - but at least it actually works properly now.
I am wrapping my hero horizontally, and there seems to be an issue when the world is bigger than the game/camera width.
CodePen Demo Here
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:
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!
The text was updated successfully, but these errors were encountered: