-
Projectile
Hi everyone,
I'm just fooling around with vb right now, and i wonder if anyone knows how to make projectiles. I'm talking about a tank, shooting a projectile at a speciefied angle and with a speciefied power, how would i calculate the positions for this projectile?
Thanks in advance,
-Shell-
-
Hi.
Have a look at this piece of code that i did, to rotate things and go in the same direction.
http://www.vbforums.com/showthread.p...hreadid=193280
Pete.
-
That helped, thanks!
But I still need to know something, how to add gravity so the projectile always ends up on the ground?
-Shell-
-
At a guess, though i'd have to fiddle with it a bit. You would have to see that when the projectile gets to a certain point/height then add a little value onto the 'DipY' variable each time. That (I think) should make it arc down.
Pete.
-
I didn't take a look at Pete's code, but if he's using a vector you can simply rotate that, until it's at 180 degrees (or hits the ground). You might need a more flexible way if you plan to add wind, such as a vector base but translating it into a speedX/speedY type thing.