The Almost Rolling Ball |
`Rolling Ball Final `Author: Hop A Long `Begun June 19, 2004 `*****SET UP***** Sync On Sync Rate 30 Autocam Off radius = 5 Hide Mouse `*****MAKE A FLOOR***** Make Object Box 10,40,2,40 Position Object 10,0,-6,0 Color Object 10,RGB(200,200,0) `*****MAKE PLAYER***** Make Object Sphere 1,10 : Position Object 1,0,0,0 YRotate Object 1,90 : Fix Object Pivot 1 Make Mesh from Object 1,1 Make Object Cylinder 2,10 : Position Object 2,0,0,0 Make Mesh from Object 2,2 : Delete Object 2 Add Limb 1,1,2 : Scale Limb 1,1,5,200,5 Color Limb 1,1,RGB(250,0,0) Make Object Cone 3,5 : Position Object 3,0,10,0 Make Mesh from Object 3,3 : Delete Object 3 Add Limb 1,2,3 : Scale Limb 1,2,25,100,25 Color Limb 1,2,RGB(250,0,0) Make Object Cylinder 4,10 : Position Object 4,0,0,0 Make Mesh from Object 4,4 : Delete Object 4 Add Limb 1,3,4 : Rotate Limb 1,3,90,0,0 Scale Limb 1,3,5,200,5 : Color Limb 1,3,RGB(0,200,0) Make Object Cone 5,5 : Position Object 5,0,10,0 Make Mesh from Object 5,5 : Delete Object 5 Add Limb 1,4,5 : Rotate Limb 1,4,90,0,0 Scale Limb 1,4,25,100,25 : Color Limb 1,4,RGB(0,200,0) `*****TEXTURE THE PLAYER***** Create Bitmap 1,256,256 : cls rgb(0,100,250) : Set Text Size 24 Center Text 128,80, " The The " Center Text 128,100," Almost Almost " Center Text 128,120,"******Rolling Ball********Rolling Ball******" Get Image 1,0,0,256,256 : Delete Bitmap 1 Texture Limb 1,0,1 ink rgb(250,250,250),0 `***************************** MAIN LOOP ******************************** Do `*****ARROW KEYS CONTROL ROLLING***** If LeftKey() = 1 z_rotation# = Wrapvalue(z_rotation# + 5.0) Inc total_z_rotation#,5 x_distance# = total_z_rotation# * .0175 * radius * (-1) Position Object 1,x_distance#,0,z_distance# ZRotate Object 1,z_rotation# Fix Object Pivot 1 z_rotation# = 0.0 Endif If RightKey() = 1 z_rotation# = Wrapvalue(z_rotation# - 5.0) Dec total_z_rotation#,5 x_distance# = total_z_rotation# * .0175 * radius * (-1) Position Object 1,x_distance#,0,z_distance# ZRotate Object 1,z_rotation# Fix Object Pivot 1 z_rotation# = 0.0 Endif If UpKey() = 1 x_rotation# = Wrapvalue(x_rotation# + 5.0) Inc total_x_rotation#,5 z_distance# = total_x_rotation# * .0175 * radius Position Object 1,x_distance#,0,z_distance# XRotate Object 1,x_rotation# Fix Object Pivot 1 x_rotation# = 0.0 Endif If DownKey() = 1 x_rotation# = Wrapvalue(x_rotation# - 5.0) Dec total_x_rotation#,5 z_distance# = total_x_rotation# * .0175 * radius Position Object 1,x_distance#,0,z_distance# XRotate Object 1,x_rotation# Fix Object Pivot 1 x_rotation# = 0.0 Endif `*****MOUSE CONTROLS ROLLING***** If MouseMoveX() <> 0 z_rotation#= Wrapvalue(z_rotation# - MouseMoveX()) total_z_rotation# = total_z_rotation# - MouseMoveX() x_distance# = total_z_rotation# * .0175 * radius * (-1) Position Object 1,x_distance#,0,z_distance# ZRotate Object 1,z_rotation# Fix Object Pivot 1 z_rotation# = 0.0 Endif If MouseMoveY() <> 0 x_rotation#= Wrapvalue(x_rotation# - MouseMoveY()) total_x_rotation# = total_x_rotation# - Mousemovey() z_distance# = total_x_rotation# * .0175 * radius Position Object 1,x_distance#,0,z_distance# XRotate Object 1,x_rotation# Fix Object Pivot 1 x_rotation# = 0.0 Endif `*****TEXT OUTPUT OF VALUES***** posx# = Object Position X(1) posz# = Object Position Z(1) Set Text Size 10 Text 10,20,"THE ALMOST ROLLING BALL" Text 10,50,"posx# : "+str$(posx#) Text 10,70,"posz# : "+str$(posz#) Text 10,90,"Moves with Mouse or Arrow Keys" `*****POSITION CAMERA***** Position Camera 0,0,-30 Point Camera 0,0,40 `*****REFRESH THE SCREEN***** Sync Loop `******************END OF LOOP******************************************** |
AT LEAST NOT WITH OUT YOUR HELP. THIS BALL ROLLS IN ANY DIRECTION: UP, DOWN, DIAGONAL. CAN BE CONTROLED WITH THE MOUSE OR ARROW KEYS |