Pong-Style Physics

Hi,

I am trying to create the calculations part for a pong-like game. The physics in the game have been really bugging me. I want it so that when it hits a wall, it bounces off at the same opposite angle. I'm in an introduction to computer science class so I don't know much advanced stuff. I will work on visually rendering the game later. Right now I want to just get it so that the calculations are working. Any ideas.

Thanks in Advance

[460 byte] By [eboteea] at [2007-11-27 5:08:12]
# 1
Is this a Java question or a trigonometry question?
Hippolytea at 2007-7-12 10:27:35 > top of Java-index,Java Essentials,Java Programming...
# 2

> I want it so that when it hits a

> wall, it bounces off at the same opposite angle.

1) look up the math (it's not complicated). if your wall is in y-direction, the y coordinate of your velocity vector stays what it is and the x coordinate of your velocity vector gets inverted

2) implement it

OnBringera at 2007-7-12 10:27:35 > top of Java-index,Java Essentials,Java Programming...
# 3
Did Pong contain "physics"?
bsampieria at 2007-7-12 10:27:35 > top of Java-index,Java Essentials,Java Programming...
# 4
Thanks, so I should use vectors for this?
eboteea at 2007-7-12 10:27:35 > top of Java-index,Java Essentials,Java Programming...
# 5
> Thanks, so I should use vectors for this?if you're gonna simulate a moving ball, it's gonna have to have a (2d) position and velocity. those are vectors whether you like it or not. is nothing to do with what you would "use" for this.
OnBringera at 2007-7-12 10:27:35 > top of Java-index,Java Essentials,Java Programming...
# 6
Vectors as in information about angle and speed, not Vector as in java.util.Vector.
bsampieria at 2007-7-12 10:27:35 > top of Java-index,Java Essentials,Java Programming...
# 7
Correct
eboteea at 2007-7-12 10:27:35 > top of Java-index,Java Essentials,Java Programming...