Bouncing Balls-VBForums
Results 1 to 11 of 11

Thread: Bouncing Balls

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800

    Post

    I can make a ball bounce around the screen, but how would i make it bounce of of objects, such as other images?

    Thanx

    Steve

    ------------------


  2. #2
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    NOTE: This is only for X direction:

    (Image1.left + width) <= Image2.left for a right collision
    (Image1.left) <= (Image2.left + width) for a left collision

    Its basically the same in the Y direction.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  3. #3
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    I think i have a project that might help.... i'll see if i can fish it out...
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  4. #4
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Found it - it's by no means perfect, but it should give you a start.

    Add a form with some shapes on it called shape (index them).

    I also experimented with curves, but that was never finished so i commented it out.

    Have to attach the file - too long to post.
    Attached Files Attached Files
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  5. #5
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004
    if you are trying to do circular collision regions, then

    Center(Image1)^2 + Center(Image2)^2 >= (Image1.Radius + Image2.Radius)^2

    would define a collision. Center() would give you the X or Y coordinate of the center of the object.

    Sorry this is all in pseudocode but it should be enough.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

  6. #6
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Originally posted by Darkwraith
    if you are trying to do circular collision regions...

    No, i can do that fine (see attached), it was getting the ball to bounce realistically off the surfaces of convex and concave curves that was the hard part. I just couldn't get my head around the mathmatics of it all.

    Thanks for the help though.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  7. #7
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    DOh, forgot to attach the file - and i cant edit the previous post to include it either, ah well, here it is.
    Attached Files Attached Files
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    damn guys....this is from 1999! I haven't used vb in over 2-3 years

  9. #9
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    LOL

    At least i wasn't the one to resurrect it.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  10. #10
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Darkwraith strikes again, thats two in about 2-3days you've brought threads back from the past, I think I'll have a go at it soon.

    The other one
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  11. #11
    Fanatic Member
    Join Date
    Jan 2003
    Posts
    1,004


    But now we have a thread on collision regions.
    "Can't" and "shouldn't" are two totally separate things.

    All questions should be answered. All answers should be true. That is why I post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.