Computer Science Canada

Pong! - A slighty different take on the classic.

Author:  WynterJones [ Wed Feb 08, 2006 9:27 pm ]
Post subject:  Pong! - A slighty different take on the classic.

I have just recently started a programming course. I decided I would make a pong game to get the feel for the turing language. I have made Pong! it is the same, but paddles are both on the X and Y axis. With this game I would like for anyone to help with coding problems, and to show graphically appealing games.

I would like to know how to fix the glitchy system I have made for the bouncing off the walls. When it bounces off the wall the balls x or y is added +20 to get away from the wall quickly so it doesn't get stuck under the paddle, causing a copious amount of point collection, not good. This system however adds for some glitchly gameplay. Any fixes?

I would also like to know how to stop the game after the procedure won or lost is called. If you win the procedure lost is quickly done after about 20 or so seconds, because the game is stilled being played by the computer under the won screen. So you will win for a little while enjoying your victory, and then it tells you have lost. Not good! Any fixes?

Thanks, and enjoy.
Wynter Jones

Author:  Cervantes [ Thu Feb 09, 2006 5:02 pm ]
Post subject:  Re: Pong! - A slighty different take on the classic.

Welcome to CompSci.ca, WynterJones. Smile

WynterJones wrote:

I would like to know how to fix the glitchy system I have made for the bouncing off the walls. When it bounces off the wall the balls x or y is added +20 to get away from the wall quickly so it doesn't get stuck under the paddle, causing a copious amount of point collection, not good. This system however adds for some glitchly gameplay. Any fixes?


Instead of adding to the score when the ball is within a certain location, add to the score when the ball JUST moved into that location. That is, it was in the middle the last frame, and this frame it is in the end zone. Thus, the ball just crossed the line. Issue a point.

WynterJones wrote:

I would also like to know how to stop the game after the procedure won or lost is called. If you win the procedure lost is quickly done after about 20 or so seconds, because the game is stilled being played by the computer under the won screen. So you will win for a little while enjoying your victory, and then it tells you have lost. Not good! Any fixes?

I didn't look at your code, but this shouldn't be very hard. Whatever loop is controlling the game play, exit it when the score of one player reaches the limit.


: