B
Brian Basquille
Hello all,
Well, we've gotten to it: the real meaty area of my Air Hockey game..
Any help or suggestions for the following would be much appreciated.
In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)
In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!
Now to the problem at hand... the puck should move in the direction opposite
to which it was struck (as a said before, a simple collision). How would i
go about implementing this in C#?
This was what i was thinking:
Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right in
saying this, or is there an easier method?
Click te link below to see a very poorly drawn diagram of what i mean. This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.
http://homepage.eircom.net/~basquilletj/airhockeycollision.jpg
Thanks again all.
Brian
Well, we've gotten to it: the real meaty area of my Air Hockey game..
Any help or suggestions for the following would be much appreciated.
In plain terms:
My paddle needs to be able to strike the puck and move in the direction
opposite to which it was struck (a simple collision, basically!)
In C# terms:
My puck is now a GraphicsPath consisting of a number of points around the
circumference. Every time the game is redrawn, i check if any of those
points on are visible inside the paddle region. If so, a collision has
occured! This seems to be working fine, by the way!
Now to the problem at hand... the puck should move in the direction opposite
to which it was struck (as a said before, a simple collision). How would i
go about implementing this in C#?
This was what i was thinking:
Draw a line tangeant to the point of intersection (the point at which the
collision between the puck and paddle is first detected). The puck should
then move in the direction right angles to that line tangeant. Am i right in
saying this, or is there an easier method?
Click te link below to see a very poorly drawn diagram of what i mean. This
is probably delving more into the Maths area than anything but any help
would be much appreciated, as i haven't even explored the maths / angles
side of C# yet.
http://homepage.eircom.net/~basquilletj/airhockeycollision.jpg
Thanks again all.
Brian