Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gravity

Status
Not open for further replies.

peter11

Instructor
Mar 16, 2001
334
0
0
US
I am trying to create gravity for a flight of a ball. The code i am using causes the ball to travel in a more triangular pattern as opposed to a arc. I am trying my best to follow the laws of gravity (for a crossover lesson with physics).

g is a constant value -- 9.8
Code:
    conv = Val(hsbAngle.Value) / 180 * 3.141592654
    shpBall.Left = shpBall.Left + Vel * Cos(conv)
    
        
    If blnDown = False Then
        Vel = Vel - g
        shpBall.Top = (shpBall.Top - ((Vel) * Sin(conv)))
    Else
        Vel = Vel + g
        shpBall.Top = (shpBall.Top + ((Vel) * Sin(conv)))
    End If
    
    If Vel <= 0 Then blnDown = True
 
You'll have to forgive me. I'm in a bad mood today. I should just go back to bed.

There used to be a time when people had to struggle with things to find answers. Nowadays, it seems like your just a google search away from any answer. In this case, a google search on "vb source gravity ball".

I didn't mean to offend anyone. I apologize for that.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
This reminds me of the qbasic gorrila.bas from dos 5.x? :)
 
lol bannana bombs

If somethings hard to do, its not worth doing - Homer Simpson
 
<How can distance/time be equal to distance/time squared?

Well, that's easy. If all is one, then time is one.

Give me a tough one.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top