HUD Alpha help please.

Blitz3D Forums/Blitz3D Programming/HUD Alpha help please.

Well, firstly, drawing images 'with alpha' can be very costly (regarding frames per second). You'd probably want to write some code to align sprites to the viewport (it's not hard) and then use the sprite's properties (e.g., EntityAlpha, EntityFX, etc.) to make it look funky in some way or another.

Just as a suggestion, the technique I use is composed of about two parts:

1. 'Initialize' the aligner. Stick a plane in front of the player, give it a pickmode (2 is best, probably), and then get the XYZ coordinates of the pixels 0,0, the XYZ coordinates of ScreenWidth,0, and the XYZ coordinates of 0,ScreenHeight. And then

Pseudo-code:
Function InitAlign(Camera)
   Create the plane
   rotate the plane so it's aligned with the camera's angle
   position the plane at the camera's position
   turn the plane by -90 along its pitch
   pick 0,0
   pick graphicswidth(),0
   pick 0,graphicsheight()
   create a pivot (refer to it as PivA)
   place PivA at the coordinates of the 0,0 pick
   create another pivot (refer to it as PivB)
   place PivB at the coordinates of the graphicswidth(),0 pick
   point PivA at PivB
   parent PivA to Camera
   free PivB
   DistanceZ# = the distance between the 0,0 pick and the graphicswidth(),0 pick and store it somewhere, maybe in a global variable
   DistanceY# = distance between the 0,0 and 0,graphicsheight() picks
   return PivA
End Function


And your function should be called before the camera is rotated, angled, etc. Otherwise, it'll screw up (probably).

2. Whenever you need the coordinates of something:

Function AlignToCamera(PivA,X,Y)
   z_mov# = (X/graphicswidth())*DistanceZ
   y_mov# = -(Y/graphicsheight())*DitanceY ;negative 'cause 2d positive goes 'down' and 3d positive goes 'up'
   moveentity PivA,0,y_mov,z_mov
   PivC = create a pivot and stick it at the position of PivA
   moveentity PivA,0,-y_mov,-z_mov ;move it back so it's reuseable
   return PivC
End Function


And there you have a (there's code in Vein for these operations, but it needs tweaking) basic example of how to get the positions. Then, you just stick a sprite there (and you'd probably want to get the positions of the x+width and y+height of the image so you can scale the sprite accordingly) and perform whatever operations on it. And parent it to the camera so it doesn't move, too..

Hope that was understandable.