dxEntityAlpha(entity%,alpha#)

Parameters

Entity - entity handle
Alpha# - alpha level of entity

Description

Sets the entity alpha level of an entity.

The alpha# value should be in a floating point value in the range 0-1. The default entity alpha setting is 1.

The alpha level is how transparent an entity is. A value of 1 will mean the entity is opaque. A value of 0 will mean the entity is completely transparent, i.e. invisible. Values between 0 and 1 will cause varying amount of transparency. This is useful for imitating the look of objects such as glass and other translucent materials.

An dxEntityAlpha value of 0 is especially useful as Blitz3D will not render entities with such a value, but will still involve the entities in collision tests. This is unlike dxHideEntity, which doesn't involve entities in dxCollisions.

Example

; dxEntityAlpha Example
; -------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()

light=dxCreateLight()
dxRotateEntity light,90,0,0

cube=dxCreateCube()
Back=dxCreateCube()

dxPositionEntity cube,0,0,5
dxPositionEntity back,0,0,15
dxScaleEntity Back,10,2,1
dxEntityColor back,255,0,0
; Set initial entity dxColor values
Alpha#=1

While Not dxKeyDown( 1 )

; Change alpha value depending on key pressed
If alpha#<0.01 Then alpha# = 0
If alpha#>1 Then alpha# = 1
If dxKeyDown( 2 )=True And Alpha#>0 Then Alpha#=Alpha#-0.01
If dxKeyDown( 3 )=True And alpha#<1 Then Alpha#=Alpha#+0.01
; Set entity alpha value
dxEntityAlpha cube,Alpha#


dxTurnEntity cube,0.1,0.1,0.1
dxTurnEntity back,1,0,0

dxRenderWorld

dxText 0,0,"Press keys 1-2 to change dxEntityAlpha"
dxText 0,20,"Entity Alpha: "+Alpha

dxFlip

Wend

End

Index