Using EntityOrder for meshes turns off z-buffering for the mesh, though, so it will cause problems with non-convex meshes. A better solution is to use a second camera, with an EntityOrder value of -1 to force it to render last.
Just stick the second camera and whatever you want to render with it outside the range of the main camera and make sure the background screen color is black, so that the background is not rendered. Once you have the second camera set up you shouldn't need to do anything else to it, beyond changing the graphics displayed whenever your program needs them changed.
Here's the function I use for setting up a second camera for displaying a heads-up-display. I'm not sure why I've got CameraClsMode set to false values (it's been a while since I've worked on the game this is from) but I think there's a good reason for it.
Function create_hud()
hud_camera = CreateCamera()
CameraRange hud_camera, 1.0, 100.0
CameraClsMode hud_camera, False, False
EntityOrder hud_camera, -1
; -- Setup HUD status display.
hud_info = LoadSprite ( "..\media\sprites\display info2.png" )
EntityOrder hud_info, -1
SpriteViewMode hud_info, 2
EntityParent hud_info, hud_camera
MoveEntity hud_info, -3.55, 2.4, 4.5
; -- Setup crosshair.
crosshair = LoadSprite ( "..\media\sprites\crosshair7.png" )
EntityOrder crosshair, 1
ScaleSprite crosshair, 0.1, 0.1
EntityParent crosshair, hud_camera
PositionEntity crosshair, 0.0, 0.0, 5.0
PositionEntity hud_camera, 0.0, 5000.0, .0
End Function
Just stick the second camera and whatever you want to render with it outside the range of the main camera and make sure the background screen color is black, so that the background is not rendered. Once you have the second camera set up you shouldn't need to do anything else to it, beyond changing the graphics displayed whenever your program needs them changed.
Here's the function I use for setting up a second camera for displaying a heads-up-display. I'm not sure why I've got CameraClsMode set to false values (it's been a while since I've worked on the game this is from) but I think there's a good reason for it.
Function create_hud()
hud_camera = CreateCamera()
CameraRange hud_camera, 1.0, 100.0
CameraClsMode hud_camera, False, False
EntityOrder hud_camera, -1
; -- Setup HUD status display.
hud_info = LoadSprite ( "..\media\sprites\display info2.png" )
EntityOrder hud_info, -1
SpriteViewMode hud_info, 2
EntityParent hud_info, hud_camera
MoveEntity hud_info, -3.55, 2.4, 4.5
; -- Setup crosshair.
crosshair = LoadSprite ( "..\media\sprites\crosshair7.png" )
EntityOrder crosshair, 1
ScaleSprite crosshair, 0.1, 0.1
EntityParent crosshair, hud_camera
PositionEntity crosshair, 0.0, 0.0, 5.0
PositionEntity hud_camera, 0.0, 5000.0, .0
End Function