
-----------------------------------
AsianSensation
Thu Apr 03, 2003 5:54 pm

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.

-----------------------------------
Catalyst
Thu Apr 03, 2003 6:10 pm


-----------------------------------
all u need to use is a basic gravity curve

this code should hep u


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

-----------------------------------
Tony
Thu Apr 03, 2003 6:15 pm


-----------------------------------
you can also add

velocityX -= wind


which will slow your missiles... or speed them up if going in same direction :wink:
