; EntityAlpha Example ; ------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,45,45,0 ; A red wall behind the ghost cube, so the transparency is visible wall=CreateCube() ScaleEntity wall,6,2,0.2 PositionEntity wall,0,0,8 EntityColor wall,255,0,0 ; The ghost cube whose alpha we will change ghost=CreateCube() PositionEntity ghost,0,0,5 alpha#=1.0 While Not KeyDown(1) ; Press + / - to change the alpha level If KeyDown(13) And alpha<1 Then alpha=alpha+0.01 If KeyDown(12) And alpha>0 Then alpha=alpha-0.01 ; Apply the transparency to the ghost cube EntityAlpha ghost,alpha TurnEntity ghost,0,1,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Text 0,0,"+ / - : change alpha Arrows: camera Esc: exit" Text 0,20,"EntityAlpha ghost,"+alpha Flip Wend End