Skill Tree Functionality

 Author: Cameron Taylor

I needed to make the skill tree so that the player didn't have the same weapons throughout the entire game. This also functioned as a store for unlocking new weapons. I constantly ran into an issue where resizing the window broke everything. This is because the assets would be drawn with premade values on the screen from -1 (left side) to 1 (right side) of the screen. That means when you resized the screen to make it wider then the width of the texture is now more pixels. There was also an issue where no texture could change color. They were all green and there was no easy way to tell if one was purchased or not.

To fix the resizing issue I needed to constantly check the width and height of the screen and compare it with the previous width and height of the screen just a frame before. Although this happens every frame the comparison doesn't hurt. If they were different values then I knew that the screen size has changed and that triggered remaking all the assets to be done. I would need to grab the new width and height and remake the assets qiad values to still be between -1 and 1, but since the screen is bigger/smaller the numbers need to be different. To make the buttons be greyscale and then change to a green texture I needed to hook into the shaders where rendering is done and manually greyscale the texture if I tell the pipeline that the texture is not unlocked.



Comments

Popular posts from this blog

Adding assets to every enemy -- Owen Meyers

Sphere to AABB collision