RPG user interface

Blitz3D Forums/Blitz3D Programming/RPG user interface

trying to get a sprite displayed infront of screen, that stays there when i move turn etc. Code below works except for the pitch, anyone know what I'm doing wrong, I'm a slacker at sin/cos so not sure if that part is wrong, or its somethingelse.

Also is displaying a sprite like that the best way of doing stat and info windows (its basically a HUD for an RPG style game). Thought about using 2d code but believe that is slower, and no fade like using entityalpha.

Any thoughts much appreciated:)



        ; display_status is a sprite 300 x 300 and alpha set to 0.2
	angle# = EntityYaw(playerbox)
	pitch# = EntityPitch(playerbox)
	
	movex# = sin#(angle#)
	movez# = cos#(angle#)
	movey# = sin#(pitch#)

	dispx# = movex# * 1.01
	dispz# = movez# * 1.01
	dispy# = movey# * 1.01

	pointx# = EntityX(playerbox) - dispx#
	pointz# = EntityZ(playerbox) + dispz#
        pointy# = EntityY(playerbox) - dispy#



	positionentity display_status, pointx#, pointy# - playergravity# + 4, pointz#


think i found something that will work, still interested in fixing this though, and on people's thoughts.

Edit: ok what i found is worse than what i have done, so still need the help:)

You could just point the entity at the camera:
PointEntity display_status,camera


Normally I would use DrawImage for display panels like this.

How about creating the sprite and then parenting it to the camera?

yeh gittech thx, just got it working, silly mistake i had done, so trying it instead of what i had

You'd be better off using a second camera for your GUI. Position it somewhere away from your game arena, but not too far away from point zero or you'll get floating point inaccuracies.

eg.

Function CreateHudCamera( L_order, x#, y#, z# )
; USAGE:
; Creates a camera to be used for a heads-up display.

; PARAMETERS:
; L_order - This sets the drawing order of the camera. 'L_order' should be a negative number, so that the HUD camera is drawn on top of the main camera graphics. The highest value negative number will be drawn last (eg. The '-2' camera will be drawn after the '-1' camera.). Note that for negative 'L_order' numbers, z-ordering is turned off for this camera as a result, so the polygons being drawn should not overlap.

; x#, y#, z# - Set the camera's absolute world position. The position should set so that the camera and its associated 3D graphic objects do not interfere with any other cameras.

; RETURNS:
; The new HUD camera's entity handle is returned.


	Local L_cam = CreateCamera()
	PositionEntity L_cam, x#, y#, z#, True ; 
	CameraRange L_cam, 0.2, 5.0
	CameraZoom L_cam, 1.6
	EntityOrder L_cam, L_order
	CameraClsMode L_cam, False, True ; This prevents the background graphics from being overwritten by the camera's clearscreen color.
	Return L_cam
End Function

HUD_camera = CreateHudCamera( -1, 0.0, -500.0, 0.0 )




--