VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code took me some thinking, but now you can make a ball bounce, not like the others where the

by USA_Geek (1 Submission)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 19th November 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code took me some thinking, but now you can make a ball bounce, not like the others where the ball just changes direction against the

Rate This code took me some thinking, but now you can make a ball bounce, not like the others where the



For intCount = 300 To 0 Step -50  '  (X to 0 step Y)  X = First bounce height, Y = How much the bounce decreases each time
    intHeight = intCount + 50  '  How high the ball will bounce (i still don't know how to measure it)
    intLength = 2000   '  Length of the bounce
    intY = ScaleHeight  '  Sets the vertical starting position of a bounce
    intCountMinus = (intHeight / 100)  '  How much to subtract from the height value as the ball ascends
    Do Until intY > ScaleHeight   '  Loops until ball hits the "ground"
        intX = intX + (intLength / 200)   '  intX moves towards its length by intervals of 1/200 the length
        intY = intY - intHeight  '  Moves the ball up by intHeight
        intHeight = intHeight - intCountMinus '  Intheight is subtracted from
        Circle (intX, intY), 300  '  Draws the ball
    Loop
Next intCount
End Sub


Private Sub Form_Load()
    intX = 0  '  Left/right starting point of ball
End Sub

Download this snippet    Add to My Saved Code

This code took me some thinking, but now you can make a ball bounce, not like the others where the Comments

No comments have been posted about This code took me some thinking, but now you can make a ball bounce, not like the others where the . Why not be the first to post a comment about This code took me some thinking, but now you can make a ball bounce, not like the others where the .

Post your comment

Subject:
Message:
0/1000 characters