; PositionTexture Example ; ----------------------- Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,2,-3 TurnEntity camera,20,0,0 light=CreateLight() RotateEntity light,45,45,0 ; A mossy ground slab - scrolling its texture makes a cheap 'conveyor belt' ground=CreateCube() ScaleEntity ground,8,0.1,8 PositionEntity ground,0,-1,8 tex=LoadTexture("media/MossyGround.BMP") ; Tile the texture 4x4 so the scrolling is easy to see ScaleTexture tex,0.25,0.25 EntityTexture ground,tex v_speed#=0.005 v_off#=0 While Not KeyDown(1) ; Press + / - to change the scroll speed If KeyDown(13) Then v_speed=v_speed+0.0001 If KeyDown(12) Then v_speed=v_speed-0.0001 ; Scroll the texture by moving its UV offset every frame v_off=v_off+v_speed PositionTexture tex,0,v_off ; 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,"+ / - : scroll speed Arrows: camera Esc: exit" Text 0,20,"PositionTexture tex,0,"+v_off Flip Wend End