How do I make two objects collide?

edited December 2017 in Python Mode

I'm building a basic paddleball game, and I'm having trouble making the ball bounce when it comes in contact with the rectangle paddle at the bottom of the screen.

Answers

  • Since your ball is somewhere on the screen, you must have some variables that determine its position. Your paddle probably also has some variables for its position too.

    What is the relationship between their positions when the ball and paddle are touching?

    Since the ball is also moving around the screen, you should also have some variables that determine its velocity. If you suddenly negated these velocity variables, what would appear to happen to the ball's direction of travel?

    So, now you know what condition is true when the ball and paddle touch. And you know what actions must occur when this situation happens. So write a conditional statement!

Sign In or Register to comment.