Computer Science Canada

Any one good with physic? Ballistic trajectory help needed

Author:  AsianSensation [ Thu Apr 03, 2003 5:54 pm ]
Post subject:  Any one good with physic? Ballistic trajectory help needed

I have decided to do a Worms types of game for my final project, therefore, I need to be able to calculate the trajectory of the missles in order to draw them. Just wondering if anyone good with physics could help me with this.

Author:  Catalyst [ Thu Apr 03, 2003 6:10 pm ]
Post subject: 

all u need to use is a basic gravity curve

this code should hep u

code:

View.Set ("graphics:640;640,offscreenonly,nobuttonbar")
var gravity : real := 0.098

var x, y, velocityX, velocityY : real

x := 100
y := 50
velocityX := 5
velocityY := 5 %% This determines the strength of ur shot
for k : 1 .. 20
    x := 100
    y := 50
    velocityY := k
    for i : 1 .. 100
        velocityY -= gravity
        x += velocityX
        y += velocityY
        drawfilloval (round (x), round (y), 15, 15, blue)
        View.Update
        cls
    end for
end for

Author:  Tony [ Thu Apr 03, 2003 6:15 pm ]
Post subject: 

you can also add
code:

velocityX -= wind


which will slow your missiles... or speed them up if going in same direction Wink


: