Results 1 to 6 of 6

Thread: Pong help VB

  1. #1
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Smile Pong help VB

    I was wondering if anyone with any knowledge in visual basics and physics would help me with making the ball bounce of moving objects like the paddles with velocity and a faster speed depending on how fast or how the ball has been hit
    thanks

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    This are never good physics. With a standard pong field where the ball is going from left to right and back to left, the paddles would only go up and down. The new speed of the ball would be the Xspeed *= -1; , but if it hits a moving paddle, you can add to the Yspeed and a percentage of the original speed of the paddle depending on the friction those two objects got.

    If you want to have objects that can be hit from multiple sides with different shapes it's more complex, how complex do you want to make it?

    edit: mix'd the x and yspeeds a bit ^^
    Last edited by masterBB; 10-13-2011 at 06:15 PM.
    Working on: Tithe Farmer

  3. #3
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    well just enough so the velocity changes with the bounce I don't want it to be as simple as it can be lol, sorry about the late replies -.- dubstep + youtube = me maxing my bandwidth? ;D

  4. #4
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    I wouldn't mind helping with the code. But I don't feel like posting exactly how to do this. If you're having trouble getting something right please send me a pm with the problem but I am not going to hold your hands with this. There are like one billion tutorials on this problem. Maybe someone else wants to help you, but I don't have enough time, sorry.
    Working on: Tithe Farmer

  5. #5
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    ah okay i was just wondering on how to get the ball to go in the direction if anyone could give me like a equation and explain it then that would be more then helpful

  6. #6
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Using the speed of the paddle might be a bit hard (as you don't really know the speed? Or are you planning on tracking that?). In my lil' experiment, I played a bit with the angle of the ball with the bat (small change when you hit the center of the bat, big change when you hit an edge). Magic happens around line 1720, but it's really specific to my liking.
    Hup Holland Hup!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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