Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Any one good with physic? Ballistic trajectory help needed
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
AsianSensation




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Catalyst




PostPosted: Thu Apr 03, 2003 6:10 pm   Post subject: (No 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
Tony




PostPosted: Thu Apr 03, 2003 6:15 pm   Post subject: (No subject)

you can also add
code:

velocityX -= wind


which will slow your missiles... or speed them up if going in same direction Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: