10/23 - 10/27
- Nathan Matarazzo
- Oct 26, 2023
- 2 min read
This week, I got some more work done on my game project. I added a pause system, and pause menu in the game scene, as well as an improved scoreboard. I improved the options menu, so the player can change different aspects of the game depending on their preferences, such as adjusting game length, and toggling abilities and SFX on and off. I fixed the jumping system of the player so it autocorrects to the correct position when the player hits the ground. I learned how to change the sprites of the characters, and I also added dunking into the game. For this, I used a series of Vector2.Lerp functions to transform the player to the top of the rim, and then I used an AddForce(new Vector2(200, -500), ForceMode2D.Impulse); function to force the ball through the rim. I am going to replace the 200 in the x-power part of the equation with a variable controlled by an rng that will determine whether a dunk goes in or not. This adds yet another dimension to the game because different players will have a different rng range for dunking the ball. I also improved the function used for detecting a travel, and I cleaned up some bugs that came up with the dunking mechanics. Furthermore, I implimented an overtime feature, where if the score is tied at the end of the game, it resets the scene while keeping the same score, and changing the time remaining to 30 seconds. If that time runs out, and the score is still tied, it will just reset the scene again with 30 seconds left, and keeping the same score until one player ends with more points than another. There is also a little icon that appears during overtime that says "OT" and then a number depending on how many overtimes have passed. If the game ends with one player having a higher score than the other, it goes to a new scene that says "Player 1 Wins!" or "Player 2 Wins!", depending on the outcome. It then has a continue button that takes you back to the beginning of the game. There aren't really any tutorials online on making a 2D basketball game, so there are many things that I've just had to figure things out for myself, (such as the dunking mechanics, or the overtime feature,) which I think has helped me gain more knowledge about making games and, more specifically, coding in Unity's engine.


There are also well over 1000 lines of code that I have written between all the game scripts, so I decided to clean up some of the code as well.



Comments