Pause Menu, Shield, and Settings

 Author: Cameron Taylor

The old pause menu was hardcoded locations for the buttons and all it had was resume and exit. The exit button brought the player back to the main menu and didn't actually close the game. The first issue I needed to overcome was adding 2 new buttons and have the buttons the side of the image. I also needed to add a bunch of new states to the pipeline to know which window I was on. This is important because the state of the game determines what we display on the screen. For the shield I ended up copying the health bar and decrement it the same way the health is done. This is an issue though because the code was never fully tested so the bar never went down all the way and displayed the incorrect amount of health and shield. I also had trouble keeping the slidebar inside the bounds since I needed to constantly update the mouse position and compare to make sure it's inside.

I ended up splitting more of the pipeline into different parts so that only certain buttons were clickable during certain states of the game. To fix the shield (and also the health bar) I had to completely rewrite the code to scale the health between (current health / max health) 0 and 1. This was really difficult to then transfer into a -1 and 1 value for NDC coordinates. And for fixing the slidebar I needed to constantly compare the position of the mouse with the outer bounds of the bar using the middle position and extents and then stopping the slide if they go outside the bounds.


Comments

Popular posts from this blog

Adding assets to every enemy -- Owen Meyers

Sphere to AABB collision