In GREAT need - Qbasic gurus HELP!
Author Message
In GREAT need - Qbasic gurus HELP!

I am in the middle of programming my space sim and ran across a few
probs.  they are as follows:

1.      I need a way of converting normal numbers to degrees, anyone got an
equation?

2.      If the UP ARROW brings the ships nose down, the DOWN ARROW brings the
nose up,
and the LEFT & RIGHT ARROWS control left and right turning, how would
you put
those into a decently short equation that would calculate your X, Y,
and Z
position?

3.      I am still in need of a FAST radar for the game. The enemy ships
positions ARE
NOT in relation to the position of the ship, they are placed in set
coordinates.
HELP?!?!?!?

Sun, 25 Jul 1999 03:00:00 GMT
In GREAT need - Qbasic gurus HELP!

Quote:
> I am in the middle of programming my space sim and ran across a few
> probs.  they are as follows:

> 1. I need a way of converting normal numbers to degrees, anyone got an
> equation?

What do you mean by "normal numbers"?  Radians?  XYZ coordinates?  What?

R = D * 3.14159265359 / 180
D = R * 180 / 3.14159265359

Here's how to convert XY coordinates to angle Theta in degrees:

Theta = ATN(Y / X) * 180 / 3.14159265359

The extension of this to the Z axis is left as an exercise for the reader (Mainly because I can't remember it at the moment).

Tom Lake

Mon, 26 Jul 1999 03:00:00 GMT
In GREAT need - Qbasic gurus HELP!

Quote:

> > I am in the middle of programming my space sim and ran across a few
> > probs.  they are as follows:

> These problems sound more like math/physics question than a programming
> question! Hehe...

Well, programing takes alot of math.  I wonder if I'll turn my spacesim
into a flightsim and include the
equasions for air friction, acceleration of gravity, pull of gravity,
and rotation of earth... NO WAY!!!

<-------SNIP------>

Quote:
> That depends on how you wish to display the radar. After all, you *are* in
> a three-dimensional space. Whatever the case, though, you would have to go
> through each coordinate and check to see if the enemy is there; or you
> could assign a coordinate of each enemy and read those coordinates off of
> each enemy; you could also update the radar display whenever you update the
> enemy's coordinate.

The Radar would be based on the X and Y coords of space with a "+" if
the enemy's above you and a "-" if it's below you.  The radar will be
fed the current X,Y, and Z coordinates of the enemy and will convert
those to  indications on the radar scope.  It will be updated every game
cycle (every time it updates the screen and variables).

Mon, 26 Jul 1999 03:00:00 GMT
In GREAT need - Qbasic gurus HELP!

Quote:
> I am in the middle of programming my space sim and ran across a few
> probs.  they are as follows:

These problems sound more like math/physics question than a programming
question! Hehe...

Quote:
> 1. I need a way of converting normal numbers to degrees, anyone got an
> equation?

Given x, y, z cartesian coordinates with x axis going from left-to-right, y
axis going up-and-down, and z axis going front-to-back, the degree can be
calculated using the following equation:

horizontal.angle.degree = atn(z/x) / 3.1415 * 180
vertical.angle.degree = atn(y / sqr(x^2 + y^2 + z^2)) / 3.1415 * 180

Quote:
> 2. If the UP ARROW brings the ships nose down, the DOWN ARROW brings the
> nose up,
>    and the LEFT & RIGHT ARROWS control left and right turning, how would
> you put
>    those into a decently short equation that would calculate your X, Y,
> and Z
>    position?

That depends.

When an object moves in space, there are several things to take into
account:

1. Which way is it facing? (the horizontal and vertical angles)
2. What fast is it traveling?
3. For which point in time do you want to calculate the position?

Say the ship is facing H angles horizontally and V angles vertically. It
travels at S speed and you want to calculate what position the ship will
occupy in T time. Then the equation becomes the following:

new.x = tan(H) * S * T * cos(H) + old.x
new.z = tan(H) * S * T * sin(H) + old.z
new.y = tan(V) * tan(H) * S * T + old.y

I just derived that using trig functions so cross your fingers! :)

Quote:
> 3. I am still in need of a FAST radar for the game. The enemy ships
> positions ARE
>    NOT in relation to the position of the ship, they are placed in set
> coordinates.
>    HELP?!?!?!?

That depends on how you wish to display the radar. After all, you *are* in
a three-dimensional space. Whatever the case, though, you would have to go
through each coordinate and check to see if the enemy is there; or you
could assign a coordinate of each enemy and read those coordinates off of
each enemy; you could also update the radar display whenever you update the
enemy's coordinate.

--
Mark K. Kim

http://members.aol.com/vindaci/
http://members.aol.com/markkkim/

Tue, 27 Jul 1999 03:00:00 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages