Project Report
Project Report
Project Goals:
- Make a simple pong game similar to table tennis
- A game where players must pass the ball back and forth using their paddles.
- Creating basic graphics and user interface designs for the game.
- To engage the player with the keyboard to engage the user in the game.
2. Design Process
Ball Movement: The ball changes direction when it hits the edges of the screen and the
paddler.
Scoring System: When the ball hits the edges of the screen, if the ball goes off the screen
without hitting a paddle, the other player gets 1 point.
Timer and Counter: a 3-second timer is set to alert players to prepare before starting each
game.
Player Controls:
Player 1 (Blue): Moves the paddle up and down using the "W" and "S" keys.
Player 2 (Red): Moves the paddle using the arrow keys ("↑" and "↓").
Screen: The game takes place on a black background with dimensions of 800x600.
Colors: The background color is black, the ball is white and the paddles colors are white. The
teams are divided into red and blue teams and the score is divided according to the team
colors.
Font: At the beginning of the game, a large white font is used to display the counters.
Technologies Used
3.Challenges Encountered
Change of Target
When we first started making the game that we thought about and planned, we had
difficulty solving our problems due to our lack of knowledge and lack of resources since it
was a new game.
Solution: We decided to leave the project that we had devoted our time to for a while and
make a recreated game.
Solution: We converted all emojis one by one to png files and put them in a folder and added
the folder to the code.
Solution: We solved this problem by randomizing the directions of movement of the two balls
at the beginning.
The logic for restarting the game after a win was problematic at first, especially concerning the
resetting of paddles and ball positions.
Solution: This was resolved by resetting the positions of all objects (paddles, balls, and scores) and
adding a countdown before starting a new round.
Countdown Timer
The countdown timer posed a minor challenge, especially when implementing it to appear at
both the start of the game and after a restart. Initially, the countdown only appeared after a
game reset. After fixing this, the countdown timer now works as expected at the beginning
and after every reset, ensuring a brief delay before the game starts.
When we created and ran our code for the counter, the counter was not visible. We could only
see the word start for a millisecond when the game started, but there was no three-second
countdown. After a lot of trials, we had difficulty getting the game to work without giving any
errors in the code. The counter needs a proper timing mechanism to track how time passes.
The use of time.sleep( ) in our code prevented the counter from working correctly.
Solution: Then we changed it and used pygame.time.get_ticks() for time control, this way we
can measure a certain time accurately and update our counter in each loop.
4.Lessons Learned
We Gained Awareness
As people who are new to programming, we were excited to see that we could create
something concrete. In fact, although we knew up until now that we could transfer what we
wanted to the computer if we continued to learn and know what we wanted with our
imagination, we felt it much more deeply by making this game.
- Event Handling: Handling user input and other events like quitting the game and restarting it
was critical in making the game interactive.
- Time Handling: Using time-based functions, like the countdown timer, to control the flow of the
game.
- Collision Detection: Implementing efficient collision detection for objects like paddles and balls
is crucial for smooth gameplay.
5.Conclusions
This Pong game project successfully combined basic game mechanics with enhancements to
improve the gameplay experience. Through challenges in collision detection, paddle shrinking,
and countdown implementation, the project provided valuable hands-on experience in game
development. The key takeaways include the importance of game loop management, collision
handling, and ensuring smooth transitions between different game states.
The game now functions as a complete two-player Pong game with dynamic difficulty through
paddle shrinking and a countdown timer.