Share your repls and programming experiences

← Back to all posts
Pong Game
sanghyunbaek081 (0)

Complete the simple game of Pong started in class. Add the following:

Reset the ball in the center if the player presses R
Fix the ball's location so the image is actually centered in the middle of the screen (hint: use the get_width() and get_height() of the image)
Add Player 2's paddle
Have Player 2 respond to I and K to go "up" and "down" (respectively)
Keep track of the score based on if the ball goes past P1 or P2's paddles and hits the left or right boundary
Add Player 2's score to the upper right corner
Add boundary rects for the world bounds
Collide the ball with the boundary rects and bounce off of them
Determine and announce a winner:
Whoever reaches 3 first "wins"
Display a message to the winner like "P1 wins!"
Stop rendering the ball if a winner has been selected (or have it hang out in the middle of the screen - basically make it stop bouncing)
When the player pressed ENTER, restart the game