WEEK 3 – SCORE SYSTEM & MORE
WHATThe third week approached and I was tasked to create the score system for our game, along with some other aspects that come with it. For this I needed to create or utilize:
HOWI started with creating the crosshair. My initial thought was just to create an object that would only contain a sprite and a script to make it follow the mouse cursor. This proved to be harder than expected. I had no trouble storing the mouse’s position, but placing the transform at that position was apparently a lot harder than I thought it to be. First of all I needed to use a ”ScreenToWorldPoint” to actually register where the mouse was in the game, to make it corelate with its position on the screen. Changing the position of the crosshair to the mouse position would only make it follow the mouse’s movement, but not exactly AT the mouse’s position. I would have to use the ”Lerp” function which linearly interpolates between two vectors. Which in this case was the transform position and mouse position. This would let them know about each other and finally be able to be set to be the same. I now started to create the score system, which I thought would be very hard, but ended up being a lot easier than expected. A complete twist from the crosshair!
I continued to create the orb pickup that would earn you points when picked up. Not a hard task, I only created an object that would spawn when an enemy was killed, and a collider that would destroy the orb on collision with the player character, and add a score value to the score total. WHYWe needed the crosshair so that the player could aim properly. We needed the score so that we could have a sense of progression in the game, where as before it was just an endless onslaught of enemies with no real reward. We needed the orb pickup because we wanted a risk that you could take to earn a reward if successful. The risk being moving out of your way to grab the orb pickup, and the reward being the extra amount of score gained. |
