Hi, I'm trying to make a 3D field in QBasic, and I'm having a few problems. Mainly in 2 functions (I think).
VB Code:
Sub Movement (X,Y,Z,Speed,Angle1, Angle2) 'angle1 is XY direction, angle2 is Z direction (supposedly) 'Sin(0) = 1 and Cos(90) = 1 right??? X = X + Speed* Sin(Angle1) * Cos(Angle2) Y = Y + Speed * Cos(Angle1) * Cos(Angle2) Z = Z + Speed * Cos(Angle1) * Sin(Angle2) End sub Sub Placement (X,Y,Z) 'This assumes your viewpoint doesn't move, to start '(I have a function for angles) AngleXY = Angle from 0,0 to X,Y Diagonal = Sqr((X^2) + (Y^2)) 'Get difference on x,y axises Distance = Sqr((Diagonal^2) + (Z^2)) 'A^2 + B^2 = C^2, I use this to set the size TrueAngle = anglesub(0,0,Diagonal,Z) 'I use this with the XY angle to place the object TargetX = 320 + (((TrueAngle) / 90) * 320) * Sin(AngleXY) TargetY = 240 + (((TrueAngle) / 90) * 320) * Cos(AngleXY) 'Use TrueAngle and XYangle to place, expand to fit screen size '240 is the center of Y, 320 is center of X, (320,240)=centerscreen '*****Set size of object here, change color to grey if FAR***** 'Sorry bout not including size code.. its not important 'Draw the point... Circle(TargetX, TargetY), Size, Color Paint(TargetX, TargetY), Color End Sub
Any ideas?




Reply With Quote