You can easily adapt a pong game to use. As the ball is meant to bounce of the top and bottom, and two paddles on right and left.
https://github.com/metulburr/pong/blob/m...all.py#L53
The part that actually changes the velocity is
By tile; do you mean tilemaps or do you mean a 4 sided object?
It doesnt matter what the angle the object that is being hit at. The angle of the object in which is initiating the hit, is. Unless you want to take into account of that angle too.
https://github.com/metulburr/pong/blob/m...all.py#L53
The part that actually changes the velocity is
self.vel[1] *= -1 self.vel[0] *= -1which reverse the velocity of the objects direction once it hits another object, making it appear to bounce off objects like a ball.
By tile; do you mean tilemaps or do you mean a 4 sided object?
It doesnt matter what the angle the object that is being hit at. The angle of the object in which is initiating the hit, is. Unless you want to take into account of that angle too.
Recommended Tutorials: