TGC Codebase Backup



XYZ Axis line thingy for confused beginners, or measuring game units by Someone

26th Mar 2004 5:00
Summary

Just a function makes 3 lines across the X Y and Z axis, well, really line of spheres. fully customisable by passing info to the function.



Description

Being a beginner to Dark Basic classic myself, I was condused at what exactly a game unit was, where in my 3D world I was, and what I should put where, and scaling and such. So i figured the basic thing to do would be make 3 lines showing X Y and Z. and maybe number them like a measuring tool. Well, I don't know how I could number them. (if you really wanted to I suppose you could make 10 textures with the numbers on them and have those applied to the spheres during the loops...)

Anyways, just give this function a XYZ coord where you want it to position its center at, then the distance you want between each dot, then the number of dots you want, then how wide you want each dot to be. I used
3DAxis(100,0,100,10,20,2)

Anyways, if it doesn't work good or something, sorry, I'm new to Dark Basic myself, and this is my first contribution to the code base.
Also, don't try callilng it more than once in your game, or making the number of dots to more than 100. I don't think it would like that.

Cheers.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Function 3DAXIS(x,y,z,dist,number,size)
   if number>99 Then Print "Error: Number may not exeed 99"
   make object sphere 1400,size*2
   Position object 1400,x,y,z
   dot=0
   Repeat
      Make Object Sphere 1100+dot,size
      Position Object 1100+dot,x+dist+(dot*dist),y,z
      Color Object 1100+dot,RGB(0,255,0)
      dot=dot+1
   Until dot=number

   dot=0
   Repeat
      Make Object Sphere 1200+dot,size
      Position Object 1200+dot,x,y+dist+(dot*dist),z
      Color Object 1200+dot,RGB(255,0,0)
      dot=dot+1
   Until dot=number

   dot=0
   Repeat
      Make Object Sphere 1300+dot,size
      Position Object 1300+dot,x,y,z+dist+(dot*dist)
      Color Object 1300+dot,RGB(0,0,255)
      dot=dot+1
   Until dot=number
EndFunction