LunaLua Render Priority

From Moondust Wiki
Jump to navigation Jump to search

The render priority (also known as z-index or z-value) is controlled by a double value.
Objects with lower render priority values are rendered first and those with higher values are rendered last.
You can specify render values with most types of drawing functions including, but not limited to Text.printWP, Graphics.drawImageToSceneWP, and Graphics.glDraw.
Any number can be used as a valid drawing priority, though they will be clamped to -100 and 10.

Default Render Values

Below is a list of all default render values and what is drawn at them.

Value Name Description
-100.0 SMBX Level Background The level background
-95.0 SMBX Backdrop BGOs BGOs that are rendered on the furthest back of the scene
-90.0 SMBX Sizeable Blocks All sizeable blocks
-85.0 SMBX BGOs All regular BGOs
-80.0 SMBX Special BGOs Special BGOs (like locks)
-75.0 SMBX Background NPCs Background NPCs like vines and piranha plants
-70.0 SMBX Warping Players The priority of the player when interacting with a warp pipe
-65.0 SMBX Blocks All normal blocks
-60.0 SMBX Background Effects Background effects like doors, pressed switches and some other stuff
-55.0 SMBX NPCs 3 Some NPCs like: coins, clown car, chompy, herbs, wood rocket, koopaling fire
-50.0 SMBX NPCs 2 Some NPCs like ice blocks
-45.0 SMBX NPCs Most regular NPCs
-40.0 SMBX Chat Icon The SMBX chat icon (which is displayed when you can talk with an NPC)
-35.0 SMBX Occupied Clown Cars Priority of the player and clown car when the player is in one
-30.0 SMBX Held NPCs NPCs held by the player
-25.0 SMBX Players and Mounts All active players on screen, as well as any mounts that they are on
-20.0 SMBX Foreground BGOs All foreground BGOs
-15.0 SMBX Foreground NPCs All foreground NPCs
-10.0 SMBX Foreground Blocks All foreground blocks
-5.0 SMBX Effects All regular effects
1.0 Image Draw Default render priority of render commands, like Graphics.drawImage
2.0 Placed Sprites Sprites placed by Autocode or Graphics.placeSprite
3.0 Text Draw Text drawn by Autocode or Text.print
5.0 SMBX HUD All elements of the SMBX HUD