Rotating Cubes by Anonymous Coder30th Dec 2004 6:31
|
---|
Summary When playing with the 3D object (CUBE) functions I wrote this quick test code Description This is a demo of the CUBE object functions. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ' Written By I J Robson in December 2004 hide mouse Sync on BackDrop On Color BackDrop 0 Set Ambient Light 30 Set Normalization On Fog Distance 200 Fog On Obj = 0 For A = 1 to 80 Step 20 For B = 1 to 80 Step 20 For C = 1 to 1000 Step 20 Inc Obj, 1 True = 0 If A = 21 then True = 1 If B = 21 then True = 1 If A = 41 then True = 1 If B = 41 then True = 1 ' print a," ", b," ", True ' sync If EscapeKey() then End If True Make Object Cube Obj, 10 Else Make Object Cube Obj, 18 Endif Color Object Obj,RGB(Rnd(512)-255,Rnd(512)-255,Rnd(512)-255) Position Object Obj, A, B, C Next C Next B Next A Pos = 400 Position Camera 10, 60, Pos Make Light 1 Set Light Range 1, 100 Direction = 1 Turn# = 0 Do For B = 1 to 360 For A = 1 to Obj XRotate Object A, B YRotate Object A, B If EscapeKey() then End Next A Sync Position Camera 30, 30, Pos Position Light 1, 30, 30, Pos ZRotate Camera (360 - B) If Pos > 700 XRotate Camera Turn# If Turn# >= 180 Direction = 0 Turn# = 180 Else Inc Turn#, 0.5 Endif Endif If Pos < 300 XRotate Camera Turn# If Turn# <= 0 Direction = 1 Turn# = 0 Else Dec Turn#, 0.5 Endif Endif If Direction = 1 Inc Pos, 1 Else Dec Pos, 1 Endif Next B Color Object Rnd(Obj), RGB(Rnd(512)-255,Rnd(512)-255,Rnd(512)-255) Loop |