Original Post
Hi, I'm trying to make a simple pong game from scratch. I don't know anything about physics or elastic collisions. Is there anyone who can give me some pointers as to handle the physics in pong. I know, it sounds pretty easy to handle, but for some reason I can't seem to comprehend simple phyiscs like this. I did look into some of the tutorials, but I couldn't find anything that would help me with balls bouncing off walls (probably because it's too simple?). I think I understand how velocity can be intrepreted into a vector, something that has magnitude and direction... So let's say we have a coordinate plane with the positive y axis going up and the positive x axis going to the right. There is a ball with velocity of (8, 2) (... and I think that means it's going to the right 2 spaces and up 8 spaces). How would you get the angle for this? Let's say there is a wall at x = 100. I guess you can tell when the collision occurs by calculating the distance between the ball and the wall every fixed period of time. And I know pythagoras so distance calculation shouldn't be a problem. But how do you calculate the angle at which it hits the wall, and the angle from which it bounces off? You could say I'm confused about the angles and when to use cosine and sine and whatever... One tutorial looked like it was talking about balls bouncing off balls, but I think that's different then balls bouncing off walls. This question was probably answered somewhere else, and I just failed to find it.... whatever... Sorry, I'm a noob. 'Nuff said.