Re: Anyone know anything about trigonometry?

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

hello David,

When the user tells the program the angle to shoot at, you should convert 
the angle and speed to component vector form.  It is easier to work with (x, 
y) than (angle, speed) internally.  First, get the x and y components for 
the velocity vector of the projectile as follows:

xspeed = cos(angle) * speed
yspeed = sin(angle) * speed

When the projectile is in motion, move the ball by an amount proportional to 
the x and y speed.  Then decrease the y speed by a number that tells the 
acceleration due to gravity.

It gets a bit more complicated than this.  A knowledge of maths (and 
physics) would help for this.  I made a small program that simulates 
projuctile motion, and you can download it at

http://www.geocities.com/daryl_vdb/euphoria

Sorry if the code is hard to understand, or the program is buggy.  Email me 
again if you want to know more.

regards,
Daryl van den Brink

>Hello all,
>
>Does anyone know anything about trigonometry? I am interested in making a
>"dueling artillery" game but cannot fathom the math needed to plot arcs. I
>know that it has something to do with arc, tan, and cos (?) but what?!
>
>So this is a call to all you mathematicians on the list ;)
>
>Thanks a lot,
>David S.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu