

Ultimate
Volleyball
This was my final project for the course "Fundamentals of Programming" (15-112). Ultimate Volleyball is your regular game of volleyball but with certain powerups to spice up the experience. You can either choose to play against a friend or play against an AI. I created it by myself using Python and Tkinter, which is Python's standard GUI package.
Complex Features
Ball Collision
In order to get the ball to bounce off the player, I had to detect when they collided with each other. To do this, I kept track of the x and y coordinates of both the player and the ball, and then used the distance formula to calculate how far apart the center of both circles was. If the distance was greater than the combined radius of both circles, I flipped the trajectory of the ball by adding a negative in front of the current velocity of the ball.


To add more variability to the game, every time there was a collision, I would calculate where on the player the ball hit in radians by using math.atan2() method from Python's math library. If the ball hit the player's left side, the ball would fly more to the left, and if the ball hit the player's right side, the ball would fly more to the right.
Player vs AI
To make the Player vs Computer option of the game possible, I needed the AI to move to where the ball was going to land in order to be able to hit it back to the player. I used projectile motion equations in order to make this happen, where I would calculate the x-coordinate of where the ball was going to land and would move the AI to that spot. Most of the times, the AI would hit it back, but there was a random chance it would miss, which made beating the AI possible.
Powerups
To make the game more interesting, I added 3 possible powerups that will randomly spawn as small multicolored circles and can be picked up by the player or the computer. The first powerup makes the player who picked it up double in size, which makes it easier to hit the ball. The second powerup makes the opponent shrink in size, which makes it harder to hit the ball. The last powerup makes the ball's velocity double in speed.
​
​
You can view examples of how the AI and Powerups work in the clip below.


Try It Yourself!
You can download the game for yourself with this link:
https://drive.google.com/file/d/1O4vN2TxmmadEFvvaPJL9oCnG4W5y9cr2/view?usp=sharing