Postmortem on Game #2, Pong
My second "completed" game from my personal #1Week1GameChallenge in order to learn and improve myself at game development.
Returning back to the roots of gaming, I start with a simple Pong.
Started with the basic functionality of moving the player up and down, and a ball that moves and collides with the wall.
At first, I had a bit of trouble figuring the range of the player's and AI's movement for the vertical axis.
Going raw, I went with checking the maximum limit of top and bottom Y axis, then write it in the script to limit the players movement.
However, this didn't go well and also it might bug out when the game is played on different resolution.
Thus, I searched online and found out Unity's Camera methods (Camera.main.ScreenToWorldPoint) would be able to set the minimum and maximum height of the screen for the player boundaries, which works really well. Then I proceed on making a Mathf.Clamp to clamp the positions of the players within the camera.
The AI pretty much tracks where the ball is moving. However, it would look weird to have it tracks all the time thus I made it stop after the ball direction is opposite from the AI side (when the ball is flying towards me).
Also, there's this 'unbeatable AI' if you set the AI speed to match with yours (or faster than the ball).
To counter that, I made the ball speed to change everytime it bounces either the player or the AI, meaning that the ball will get faster and if the ball speed is whole lot faster than the AI, it should be able to get past through its defense.
That's all for the important points for this game.
Going to proceed on creating new projects, for the sake of learning the engine and to be better at doing what I like.
Thank you for reading!
Leave a comment
Log in with itch.io to leave a comment.