Re: Trig and the infamous "45 degree angle bug"

new topic     » goto parent     » topic index » view thread      » older message » newer message

[Asteroids clones]
There are two ways that you can approach these, either making your game what
you consider to be the most playable, or the most realistic. I assume you have
opted for (1) as barring relativity there is no maximum speed in space.

> So I need some *FAST* functions to find the angle given the x and y
>  lengths (XV and YV), and a function to return XV and YV given speed and
>  angle.

The angle you wanted can be calculated using atan(YV/XV). If Euphoria's atan()
is too slow, most of the PI programmes have one, and you could get Pete or
some other asm genius to port one for you.

>  Why do I need this stuff, exactly? I know the ship is going too fast, so
>  I need to slow it down. The old method just checks to see if the XV is
..
>  The ship is going too fast. (sqrt((xv*xv)+(yv*yv))=speed) I need to slow
>  it down. I get the angle that the ship is trying to go, then slow that

Pete's technique for this looks dead right to me.

NB I have some code for simulating gravity. It uses the proper physical
formulas and values, so if any of you space-gamers are not into physics, send
me a mail and you'll be saved the slog.

Daniel

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu