# missiles with parabolic paths for Magnant (C language).

Discussion in 'C Programming' started by mohydine, Sep 17, 2003.

1. ### mohydineGuest

Hi,

I am trying to implement some parabolic trajectories for the missiles
used in the game Magnant (http://www.insectwar.com) . It would enable
Ants to shoot more realistic arrows to other ants.

Right now ants are shooting point to point arrows, that follow along a
straight path (a line).

I am wondering if anybody knows a good algorithm or a good formula for
implementing this?

The GPL code is currently written like this ( stratagus engine v1.18 ):

I can send the complete .C if necessary.

int dx;

int dy;

int xstep;

int ystep;

int i;

if( !(missile->State&1) ) {

// initialize

dy=missile->DY-missile->Y;

ystep=1;

if( dy<0 ) {

dy=-dy;

ystep=-1;

}

dx=missile->DX-missile->X;

xstep=1;

if( dx<0 ) {

dx=-dx;

xstep=-1;

}

// FIXME: could be better written

if( missile->Type->Class == MissileClassWhirlwind

|| missile->Type->Class == MissileClassFlameShield ) {

// must not call MissileNewHeading nor frame change

} else if( missile->Type->Class == MissileClassBlizzard ) {

missile->SpriteFrame = 0;

} else if( missile->Type->Class == MissileClassPointToPoint3Bounces ) {

missile->DX-=xstep*TileSizeX/2;

missile->DY-=ystep*TileSizeY/2;

} else {

}

if( dy==0 ) { // horizontal line

if( dx==0 ) {

return 1;

}

} else if( dx==0 ) { // vertical line

} else if( dx<dy ) { // step in vertical direction

missile->D=dy-1;

dx+=dx;

dy+=dy;

} else if( dx>dy ) { // step in horizontal direction

missile->D=dx-1;

dx+=dx;

dy+=dy;

}

missile->Dx=dx;

missile->Dy=dy;

missile->Xstep=xstep;

missile->Ystep=ystep;

++missile->State;

DebugLevel3Fn("Init: %d,%d, %d,%d, =%d\n"

_C_ dx _C_ dy _C_ xstep _C_ ystep _C_ missile->D);

return 0;

} else {

// on the way

dx=missile->Dx;

dy=missile->Dy;

xstep=missile->Xstep;

ystep=missile->Ystep;

}

//

// Move missile

//

if( dy==0 ) { // horizontal line

for( i=0; i<missile->Type->Speed; ++i ) {

if( missile->X==missile->DX ) {

return 1;

}

missile->X+=xstep;

}

return 0;

}

if( dx==0 ) { // vertical line

for( i=0; i<missile->Type->Speed; ++i ) {

if( missile->Y==missile->DY ) {

return 1;

}

missile->Y+=ystep;

}

return 0;

}

if( dx<dy ) { // step in vertical direction

for( i=0; i<missile->Type->Speed; ++i ) {

if( missile->Y==missile->DY ) {

return 1;

}

missile->Y+=ystep;

missile->D-=dx;

if( missile->D<0 ) {

missile->D+=dy;

missile->X+=xstep;

}

}

return 0;

}

if( dx>dy ) { // step in horizontal direction

for( i=0; i<missile->Type->Speed; ++i ) {

if( missile->X==missile->DX ) {

return 1;

}

missile->X+=xstep;

missile->D-=dy;

if( missile->D<0 ) {

missile->D+=dx;

missile->Y+=ystep;

}

}

return 0;

}

// diagonal line

for( i=0; i<missile->Type->Speed; ++i ) {

if( missile->Y==missile->DY ) {

return 1;

}

missile->X+=xstep;

missile->Y+=ystep;

}

return 0;

Mohydine

--
Posted via http://dbforums.com

mohydine, Sep 17, 2003

2. ### Joona I PalasteGuest

mohydine <> scribbled the following:
> Hi,

> I am trying to implement some parabolic trajectories for the missiles
> used in the game Magnant (http://www.insectwar.com) . It would enable
> Ants to shoot more realistic arrows to other ants.

> Right now ants are shooting point to point arrows, that follow along a
> straight path (a line).

> I am wondering if anybody knows a good algorithm or a good formula for
> implementing this?

> The GPL code is currently written like this ( stratagus engine v1.18 ):

(snip code)

The code you posted was in a very unreadable format. Please don't
insert gratuitous blank lines between source code lines (there seemed
to be 2 blank lines between *every* line of your code), and please,
level.

--
/-- Joona Palaste () ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"You can pick your friends, you can pick your nose, but you can't pick your
relatives."

Joona I Palaste, Sep 17, 2003

3. ### Richard HeathfieldGuest

mohydine wrote:

>
> Hi,
>
>
>
> I am trying to implement some parabolic trajectories for the missiles
> used in the game Magnant (http://www.insectwar.com) . It would enable
> Ants to shoot more realistic arrows to other ants.
>
>
>
> Right now ants are shooting point to point arrows, that follow along a
> straight path (a line).
>
>
>
> I am wondering if anybody knows a good algorithm or a good formula for
> implementing this?

Let the arrow be fired with an initial velocity V, and an initial angle of
alpha radians from the horizontal, in a gravitational field accelerating
falling bodies at g.

Its initial upward velocity is V sin alpha, and its sideways velocity V cos
alpha. If you ignore air resistance, it'll keep going sideways until it
hits something. Its upward velocity decreases by g each second.

Take it from there.

--
Richard Heathfield :
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton

Richard Heathfield, Sep 17, 2003
4. ### Bertrand Mollinier ToubletGuest

[OT] Re: missiles with parabolic paths for Magnant (C language).

Richard Heathfield wrote:
> mohydine wrote:
>>Hi,
>>
>>I am trying to implement some parabolic trajectories for the missiles
>>used in the game Magnant (http://www.insectwar.com) . It would enable
>>Ants to shoot more realistic arrows to other ants.
>>
>>Right now ants are shooting point to point arrows, that follow along a
>>straight path (a line).
>>
>>I am wondering if anybody knows a good algorithm or a good formula for
>>implementing this?

>
> Let the arrow be fired with an initial velocity V, and an initial angle of
> alpha radians from the horizontal, in a gravitational field accelerating
> falling bodies at g.
>
> Its initial upward velocity is V sin alpha, and its sideways velocity V cos
> alpha. If you ignore air resistance, it'll keep going sideways until it
> hits something. Its upward velocity decreases by g each second.
>
> Take it from there.
>

Richard,

I'd like to allow myself to quote you: "This is a wonderful answer. It's
off-topic, it's incorrect, and it doesn't answer the question."

doesn't really answer the question (in that, IMHO, it is not all that
helpful for an algorithm). I guess we'll have to settle to qualify it as

If you liked physics as much as I did, I can understand why you could
not resist the urge to show off what you knew, but don't you think it
deserved to at least be flagged as OT, let alone cross-posted and fu2 to
sci.physics.shooting-arrows or something ?

Ah well... don't mind me...
--
Bertrand Mollinier Toublet
Currently looking for employment in the San Francisco Bay Area
http://www.bmt.dnsalias.org/employment

Bertrand Mollinier Toublet, Sep 17, 2003
5. ### Mark McIntyreGuest

On Wed, 17 Sep 2003 16:38:36 -0400, in comp.lang.c , mohydine
<> wrote:

>
>Hi,
>
>
>
>I am trying to implement some parabolic trajectories for the missiles
>used in the game Magnant (http://www.insectwar.com) . It would enable
>Ants to shoot more realistic arrows to other ants.
>
>I am wondering if anybody knows a good algorithm or a good formula for
>implementing this?
>

Virtually any A level maths student or physical science undergrad
wouild know an algo for this. In fact you could could look up the
formula for the parabola in pretty much any textbook. This is not a C
question.

When you're posting from web-based sources, you need to remember that
they almost certainly screw up your line endings. In your case, the
cut-paste resulted in every CR being translated into CRLF and every LF
_also_ being translated into CRLF.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>

Mark McIntyre, Sep 17, 2003
6. ### Richard HeathfieldGuest

Re: [OT] Re: missiles with parabolic paths for Magnant (C language).

Bertrand Mollinier Toublet wrote:

<extremely elementary projectiles stuff snipped>

> Richard,
>
> I'd like to allow myself to quote you: "This is a wonderful answer. It's
> off-topic, it's incorrect, and it doesn't answer the question."
>

That's a relief.

> It is just off-topic and
> doesn't really answer the question (in that, IMHO, it is not all that

It was intended to set the OP thinking. I /could/ have scribbled out the C
code for him, but that would have been "doing the homework", which I was
loathe to do. I was hoping to get him to realise that he's gonna have to

> I guess we'll have to settle to qualify it as
> only "good" instead of wonderful.

<grin>

>
> If you liked physics as much as I did, I can understand why you could
> not resist the urge to show off what you knew,

Oh, but I /did/ resist. I was all set to show him how to calculate time of
flight, height at a given time, maximising range whilst taking air
resistance into account, and heaven knows what else; but I managed to
prevent myself from doing this, on the grounds that it would teach him

> but don't you think it
> deserved to at least be flagged as OT, let alone cross-posted and fu2 to
> sci.physics.shooting-arrows or something ?

It didn't occur to me, to be honest with you. Sorry about that.

--
Richard Heathfield :
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton

Richard Heathfield, Sep 18, 2003
7. ### nrkGuest

Re: [OT] Re: missiles with parabolic paths for Magnant (C language).

Bertrand Mollinier Toublet wrote:

<snip>

>
> I'd like to allow myself to quote you: "This is a wonderful answer. It's
> off-topic, it's incorrect, and it doesn't answer the question."
>
> (Un)fortunately, your answer is correct enough. It is just off-topic and
> doesn't really answer the question (in that, IMHO, it is not all that
> helpful for an algorithm). I guess we'll have to settle to qualify it as
> only "good" instead of wonderful.
>
> If you liked physics as much as I did, I can understand why you could
> not resist the urge to show off what you knew, but don't you think it
> deserved to at least be flagged as OT, let alone cross-posted and fu2 to
> sci.physics.shooting-arrows or something ?
>
> Ah well... don't mind me...

Actually, it is a pretty reasonable answer (OT, but reasonable). All the OP
needs to do is recollect some high-school physics that says
s = ut + 0.5 at^2, s being distance, u being initial velocity, a being
acceleration and t being time, to simulate the x and y co-ords. of the
projectile.

-nrk.

nrk, Sep 18, 2003
8. ### mohydineGuest

HI all,

First thanks for your answers. Unfortunately, this is not helping me a
lot.

As you suggested, I used simple parabolic formula, w/o using t, but
using a simple y=f(x).

x=x+step;

so y=yo+Cst*Sqrt[(x-xm)^2-(xo-xm)^2];

where (xo,yo) is starting point, xm is such that dy(xm) /dx=0.

I can get xm from

Xd=missile->DX; // impact of the missile X

Yd=missile->DY; // impact of the missile Y

Xo=missile->SourceX; //Source missile X

Yo=missile->SourceY; //Source missile Y

then

Xm=(-1/Cst*(Yd-Yo)*(Yd-Yo)+Xd*Xd-Xo*Xo)/(2*(Xd-Xo));

Since I know which parabola I am going to use(3 parameters known)

it works fine if yD(destination(impact of missible))= y0, but I can't
have it working when yd<yo. Even if I know my 3 parameters formula

any idea? Mathematically, I can't find the problem. So that is why I am
wondering if this has something to do with the C implementation or
something else.

Sorry for posting so much code.

Mohydine

--
Posted via http://dbforums.com

mohydine, Sep 18, 2003
9. ### Rajasekar RamakrishnanGuest

hi,
i am actually new to c.l.c
and i happen to read lots of mails in this newsgroup

and the very bad part of this newsgroup
is that ppl start to hurt a newbie, if the person asks for a very basic doubt

and that too, joona i palaste, if i could see ur mails i could only
know that you do not provide solutions
but mostly ask people to not send basic doubts to this comp.lang.c

i think the news readers need to be more professional, not all of them

please try to help a novice or if not, keep mum , so that he is not
discouraged

rajasekar.

Joona I Palaste wrote:

> mohydine <> scribbled the following:
> > Hi,

>
> > I am trying to implement some parabolic trajectories for the missiles
> > used in the game Magnant (http://www.insectwar.com) . It would enable
> > Ants to shoot more realistic arrows to other ants.

>
> > Right now ants are shooting point to point arrows, that follow along a
> > straight path (a line).

>
> > I am wondering if anybody knows a good algorithm or a good formula for
> > implementing this?

>
> > The GPL code is currently written like this ( stratagus engine v1.18 ):

>
> (snip code)
>
> The code you posted was in a very unreadable format. Please don't
> insert gratuitous blank lines between source code lines (there seemed
> to be 2 blank lines between *every* line of your code), and please,
> level.
>
> --
> /-- Joona Palaste () ---------------------------\
> | Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
> | http://www.helsinki.fi/~palaste W++ B OP+ |
> \----------------------------------------- Finland rules! ------------/
> "You can pick your friends, you can pick your nose, but you can't pick your
> relatives."

Rajasekar Ramakrishnan, Sep 18, 2003
10. ### Joona I PalasteGuest

Rajasekar Ramakrishnan <> scribbled the following:
> This is a multi-part message in MIME format.
> --------------8ABFF92D41955E546EDA90A4
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit

Don't do that.

> hi,
> i am actually new to c.l.c
> and i happen to read lots of mails in this newsgroup

> and the very bad part of this newsgroup
> is that ppl start to hurt a newbie, if the person asks for a very basic doubt

Expressing criticism is not hurting. Did you see me insult or flame the
OP anywhere?

> and that too, joona i palaste, if i could see ur mails i could only
> know that you do not provide solutions
> but mostly ask people to not send basic doubts to this comp.lang.c

Did you see me ask the OP not to send basic doubts anywhere? All I
said that he should reformat the code better.

> i think the news readers need to be more professional, not all of them

> please try to help a novice or if not, keep mum , so that he is not
> discouraged

Which would mean that if the OP's code was bad, we shouldn't have to
tell him that, because it would hurt his feelings and scar him
emotionally. Thus he wouldn't know that his code could be better, and
go on writing bad code. That doesn't fit in with my vision of the world.

You seem to be mistaking telling someone "you are not the greatest
coder to walk this Earth (yet)" with telling him "you are a pathetic
loser". I was doing the former, not the latter.

(v-card snipped)

--
/-- Joona Palaste () ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"You could take his life and..."
- Mirja Tolsa

Joona I Palaste, Sep 18, 2003
11. ### Daniel HaudeGuest

On Thu, 18 Sep 2003 12:05:20 +0530,
Rajasekar Ramakrishnan <> wrote
in Msg. <>

> This is a multi-part message in MIME format.

....which is something we don't like to see on Usenet.

> and the very bad part of this newsgroup
> is that ppl start to hurt a newbie, if the person asks for a very basic doubt
> and that too, joona i palaste, if i could see ur mails i could only
> know that you do not provide solutions
> but mostly ask people to not send basic doubts to this comp.lang.c

He didn't do that. He merely told the OP that he'd like to see more
legible code, and quite politely so:

>> The code you posted was in a very unreadable format. Please don't
>> insert gratuitous blank lines between source code lines (there seemed
>> to be 2 blank lines between *every* line of your code), and please,
>> level.

> please try to help a novice or if not, keep mum , so that he is not
> discouraged

If the novice can't deal with polite criticism, that's his problem. I
mean, what do you expect -- most novices obviously haven't read the Usenet
netiquette (like you, by the way), let alone the C FAQ.

It's rude to post into a C language Usenet group not having done your
homework and knowing zilch about either C or Usenet. It's not rude to
politely criticize such behavior.

--Daniel

--
"With me is nothing wrong! And with you?" (from r.a.m.p)

Daniel Haude, Sep 18, 2003
12. ### Randy HowardGuest

In article <>,
says...
> I am trying to implement some parabolic trajectories for the missiles
> used in the game Magnant (http://www.insectwar.com) . It would enable
> Ants to shoot more realistic arrows to other ants.

I snipped the code, because it was unreadable, as already pointed out
to you. If you really want it to be be accurate, I would recommend a
book called "Understanding Firearm Ballistics" by Robert A. Rinker.
The subject also applies pretty well to missiles, particularly if you
focus on the external ballistics section and disregard the internal stuff
like chamber pressure, twist rates, gyroscopic drift (assuming your
missile isn't spinning it won't have an effect), powders, primers,
temperature, etc. You probably can also disregard the terminal
ballistics portion (what happens to the object that gets hit by the
bullet). It includes drag, wind deflection and all the trajectory
info you can imagine.

--
Randy Howard _o
______________________()/ ()______________________________________________
SCO Spam-magnet:

Randy Howard, Sep 18, 2003
13. ### Lawrence V. CiprianiGuest

In article <>,
Mark McIntyre <> wrote:
>On Wed, 17 Sep 2003 16:38:36 -0400, in comp.lang.c , mohydine
><> wrote:
>
>>I am trying to implement some parabolic trajectories for the missiles
>>used in the game Magnant (http://www.insectwar.com) . It would enable
>>Ants to shoot more realistic arrows to other ants.
>>
>>I am wondering if anybody knows a good algorithm or a good formula for
>>implementing this?
>>

>Virtually any A level maths student or physical science undergrad
>wouild know an algo for this. In fact you could could look up the
>formula for the parabola in pretty much any textbook. This is not a C
>question.

Search for a free exterior ballistics program. It would be a lot more
realistic than a simple parabolic curve.

Lawrence V. Cipriani, Sep 18, 2003
14. ### Mark McIntyreGuest

Re: [OT] Re: missiles with parabolic paths for Magnant (C language).

On Wed, 17 Sep 2003 18:18:45 -0500, in comp.lang.c , nrk
<> wrote:

>
>Actually, it is a pretty reasonable answer (OT, but reasonable). All the OP
>needs to do is recollect some high-school physics that says
>s = ut + 0.5 at^2, s being distance, u being initial velocity, a being
>acceleration and t being time, to simulate the x and y co-ords. of the
>projectile.

Helps if you can remember how to rotate a frame of reference too, so
you can normalise the equations wrt the straight line joining the two
objects, even when they're in relative motion..
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>

Mark McIntyre, Sep 18, 2003
15. ### Mark McIntyreGuest

On Thu, 18 Sep 2003 12:05:20 +0530, in comp.lang.c , Rajasekar
Ramakrishnan <> wrote:

>and the very bad part of this newsgroup
>is that ppl start to hurt a newbie, if the person asks for a very basic doubt

I realise that english is not your first language, but a douby is not
the same as a question.

>and that too, joona i palaste, if i could see ur mails i could only
>know that you do not provide solutions

but the purpose of this group is NOT to give people the answer to
their problem so that they don't havae to think, but to help them

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>

Mark McIntyre, Sep 18, 2003
16. ### Daniel HaudeGuest

On Thu, 18 Sep 2003 21:42:32 +0100,
Mark McIntyre <> wrote
in Msg. <>

> I realise that english is not your first language, but a douby is not
> the same as a question.

Damn right fifteen! Doubylessy.

--Daniel

--
"With me is nothing wrong! And with you?" (from r.a.m.p)

Daniel Haude, Sep 18, 2003
17. ### WA SupportGuest

Hello,

You might want to look at one of these:

A favorite: Numerical Recipes in C.
http://www.amazon.com/exec/obidos/A...3925714/sr=2-2/ref=sr_2_2/102-1529691-5952103

which I find more useful than
Numerical Algorithms in C.
http://www.springer-ny.com/detail.tpl?cart=10427407061157171&ISBN=3540605304

which is reviewed (not too favorably) here
http://www.accu.org/bookreviews/public/reviews/n/n002066.htm

BTW: accu.org is the Association of C & C++ Users

Murrah Boswell

On Wed, 17 Sep 2003 16:38:36 -0400, mohydine
<> wrote:

>
>Hi,
>
>
>
>I am trying to implement some parabolic trajectories for the missiles
>used in the game Magnant (http://www.insectwar.com) . It would enable
>Ants to shoot more realistic arrows to other ants.
>
>
>
>Right now ants are shooting point to point arrows, that follow along a
>straight path (a line).
>
>
>
>I am wondering if anybody knows a good algorithm or a good formula for
>implementing this?
>
>
>
>The GPL code is currently written like this ( stratagus engine v1.18 ):
>
>
>
>I can send the complete .C if necessary.
>
>
>
>int dx;
>
>
>
>int dy;
>
>
>
>int xstep;
>
>
>
>int ystep;
>
>
>
>int i;
>
>
>
>if( !(missile->State&1) ) {
>
>
>
>// initialize
>
>
>
>dy=missile->DY-missile->Y;
>
>
>
>ystep=1;
>
>
>
>if( dy<0 ) {
>
>
>
>dy=-dy;
>
>
>
>ystep=-1;
>
>
>
>}
>
>
>
>dx=missile->DX-missile->X;
>
>
>
>xstep=1;
>
>
>
>if( dx<0 ) {
>
>
>
>dx=-dx;
>
>
>
>xstep=-1;
>
>
>
>}
>
>
>
>// FIXME: could be better written
>
>
>
>if( missile->Type->Class == MissileClassWhirlwind
>
>
>
>|| missile->Type->Class == MissileClassFlameShield ) {
>
>
>
>// must not call MissileNewHeading nor frame change
>
>
>
>} else if( missile->Type->Class == MissileClassBlizzard ) {
>
>
>
>missile->SpriteFrame = 0;
>
>
>
>} else if( missile->Type->Class == MissileClassPointToPoint3Bounces ) {
>
>
>
>missile->DX-=xstep*TileSizeX/2;
>
>
>
>missile->DY-=ystep*TileSizeY/2;
>
>
>
>} else {
>
>
>
>
>
>
>}
>
>
>
>if( dy==0 ) { // horizontal line
>
>
>
>if( dx==0 ) {
>
>
>
>return 1;
>
>
>
>}
>
>
>
>} else if( dx==0 ) { // vertical line
>
>
>
>} else if( dx<dy ) { // step in vertical direction
>
>
>
>missile->D=dy-1;
>
>
>
>dx+=dx;
>
>
>
>dy+=dy;
>
>
>
>} else if( dx>dy ) { // step in horizontal direction
>
>
>
>missile->D=dx-1;
>
>
>
>dx+=dx;
>
>
>
>dy+=dy;
>
>
>
>}
>
>
>
>missile->Dx=dx;
>
>
>
>missile->Dy=dy;
>
>
>
>missile->Xstep=xstep;
>
>
>
>missile->Ystep=ystep;
>
>
>
>++missile->State;
>
>
>
>DebugLevel3Fn("Init: %d,%d, %d,%d, =%d\n"
>
>
>
>_C_ dx _C_ dy _C_ xstep _C_ ystep _C_ missile->D);
>
>
>
>return 0;
>
>
>
>} else {
>
>
>
>// on the way
>
>
>
>dx=missile->Dx;
>
>
>
>dy=missile->Dy;
>
>
>
>xstep=missile->Xstep;
>
>
>
>ystep=missile->Ystep;
>
>
>
>}
>
>
>
>//
>
>
>
>// Move missile
>
>
>
>//
>
>
>
>if( dy==0 ) { // horizontal line
>
>
>
>for( i=0; i<missile->Type->Speed; ++i ) {
>
>
>
>if( missile->X==missile->DX ) {
>
>
>
>return 1;
>
>
>
>}
>
>
>
>missile->X+=xstep;
>
>
>
>
>
>}
>
>
>
>return 0;
>
>
>
>}
>
>
>
>if( dx==0 ) { // vertical line
>
>
>
>for( i=0; i<missile->Type->Speed; ++i ) {
>
>
>
>if( missile->Y==missile->DY ) {
>
>
>
>return 1;
>
>
>
>}
>
>
>
>missile->Y+=ystep;
>
>
>
>}
>
>
>
>return 0;
>
>
>
>}
>
>
>
>
>
>
>
>if( dx<dy ) { // step in vertical direction
>
>
>
>for( i=0; i<missile->Type->Speed; ++i ) {
>
>
>
>if( missile->Y==missile->DY ) {
>
>
>
>return 1;
>
>
>
>}
>
>
>
>missile->Y+=ystep;
>
>
>
>missile->D-=dx;
>
>
>
>if( missile->D<0 ) {
>
>
>
>missile->D+=dy;
>
>
>
>missile->X+=xstep;
>
>
>
>}
>
>
>
>}
>
>
>
>return 0;
>
>
>
>}
>
>
>
>if( dx>dy ) { // step in horizontal direction
>
>
>
>for( i=0; i<missile->Type->Speed; ++i ) {
>
>
>
>if( missile->X==missile->DX ) {
>
>
>
>return 1;
>
>
>
>}
>
>
>
>missile->X+=xstep;
>
>
>
>missile->D-=dy;
>
>
>
>if( missile->D<0 ) {
>
>
>
>missile->D+=dx;
>
>
>
>missile->Y+=ystep;
>
>
>
>}
>
>
>
>}
>
>
>
>return 0;
>
>
>
>}
>
>
>
>// diagonal line
>
>
>
>for( i=0; i<missile->Type->Speed; ++i ) {
>
>
>
>if( missile->Y==missile->DY ) {
>
>
>
>return 1;
>
>
>
>}
>
>
>
>missile->X+=xstep;
>
>
>
>missile->Y+=ystep;
>
>
>
>}
>
>
>
>return 0;
>
>
>
>
>
>
>
>Mohydine
>
>
>--
>Posted via http://dbforums.com

WA Support, Sep 19, 2003
18. ### AlexGuest

WA Support <> wrote:
> Hello,

> You might want to look at one of these:

<snip>

Seriously, stop top-posting. Also, please trim parts of the original

Alex

Alex, Sep 19, 2003
19. ### WA SupportGuest

Top posting was a direct response to the original question, and I
gave him useful information instead of all the anal ankle biting.

Murrah Boswell

On Thu, 18 Sep 2003 23:08:30 GMT, Alex <> wrote:

>WA Support <> wrote:
>> Hello,

>
>> You might want to look at one of these:

>
> <snip>
>
>Seriously, stop top-posting. Also, please trim parts of the original
>
>Alex

WA Support, Sep 19, 2003
20. ### AlexGuest

<rearranged>

WA Support <> wrote:
> On Thu, 18 Sep 2003 23:08:30 GMT, Alex <> wrote:
>>WA Support <> wrote:
>>> Hello,

>>
>>> You might want to look at one of these:

>>
>> <snip>
>>
>>Seriously, stop top-posting. Also, please trim parts of the original
>>

> Top posting was a direct response to the original question, and I
> gave him useful information instead of all the anal ankle biting.

I think that you are failing to grasp the concepts of top-posting
and bottom-posting. Take a look at this message, then take a look
at your previous message. If you still don't get it, I can't help
you.

Alex

Alex, Sep 19, 2003