RPG user interface

Blitz3D Forums/Blitz3D Programming/RPG user interface

Nicstt(Posted 2005) [#1]
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#



Nicstt(Posted 2005) [#2]
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:)


Banshee(Posted 2005) [#3]
You could just point the entity at the camera:
PointEntity display_status,camera


Normally I would use DrawImage for display panels like this.


GitTech(Posted 2005) [#4]
How about creating the sprite and then parenting it to the camera?


Nicstt(Posted 2005) [#5]
yeh gittech thx, just got it working, silly mistake i had done, so trying it instead of what i had


Zethrax(Posted 2005) [#6]
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.




--