Results 1 to 5 of 5

Thread: Projectile

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Location
    Far.. far away! (Netherlands)
    Posts
    169

    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-

  2. #2
    Addicted Member Peter1's Avatar
    Join Date
    Aug 2002
    Posts
    166
    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Location
    Far.. far away! (Netherlands)
    Posts
    169
    That helped, thanks!
    But I still need to know something, how to add gravity so the projectile always ends up on the ground?

    -Shell-

  4. #4
    Addicted Member Peter1's Avatar
    Join Date
    Aug 2002
    Posts
    166
    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.

  5. #5
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    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.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width