Using layers() when not everything has the same parent #411
Unanswered
dragoncoder047
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Not yet. I need to rewrite the collecting and sorting of the objects before rendering in order to make sorting work globally. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Even if you load the level async, you could always level.spawn a new player inside the level once it is loaded and created. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I'm making a platformer. The world tree look roughly like this:
What I want to do, is if the player is grabbing the item, change the layer so it draws on top of the player, while everything else in the level is drawn behind the player.
However, the reason the player is NOT a child of the world, is that the level is stored in a text file, which must be loaded asynchronously. As a result, everything in the level renders as its own "layer" so to speak, either it's all behind the player, or it's all on top of the player, depending on the layers. I tried re-parenting the player to the world, but it just causes more problems than it solves.
Can this be accomplished using layers(), z(), etc.?
EDIT:
Here is an example to demonstrate:
The layers are world, then player, then coins. But the coins are not rendered on top.
The player is not a child of the world. The coins are. So the world is not in the coins layer and so renders everything that is a child of the world first, so the player is on top of the coins.
Beta Was this translation helpful? Give feedback.
All reactions