Game Dev in Progress… Day 10

Cristian Aspacio
2 min readNov 4, 2020

--

Photo by Valeriy Khan on Unsplash

Hello and welcome to Game Dev in Progress Day 10. Today was a pretty chill day where I was able to finish Phase I: Framework section of the 2D course. With this I am almost done with the 2D course, I just need to get to the hardest section Phase II: Core Programming. Before I talk about that part, I’ll briefly go over the things that I learned today.

The first thing I learned was how to create a UI Scaling Bar that would fill or drain depending on the action the player took. This particular bar was meant to keep track of the thruster which if the player pressed and held down the Left-Shift, it would increase the speed of the player ship. The bar would fill up as you held down the key and it would slowly drain when you didn’t. When it reaches 100%, it would stop you from using the thrusters boost and would slowly drain until its at 0%, then it would allow you to use it again. This problem took me quite awhile to figure out, but I was able to at the end. Essentially what I did was have a variable keep track of the percentage of the bar, and when I pressed down on the Left-Shift, it would increment this variable. The bar would drain when I didn’t hold down the key by decrementing the variable. I also had Coroutine set up when the bar reaches 100%. This way the coroutine would slowly drain the bar and stop the user from using the thrusters while not hindering there movement.

The second thing I learned was when I was figuring out how to do a camera shake. There was a lot of cool ways to do it, such as using Perlin Noise, but I did a more simple approach. A summary of what I did was that I calculate a random off set by using Random.value, multiplying it by a factor/magnitude of the shake (so how strong the shake is), doubling that and then subtracting the magnitude. Then I added this offset inside a coroutine that would run for a certain amount of time before reverting the camera back to its original position.

Anyways, the challenging part is about to begin tomorrow. When I looked at some to the challenges/expected features that I have to implement, made me a bit nervous. Hopefully I’ll be alright and learn something new. Well thank you for reading, have a nice day!

_

Cristian Aspacio

--

--

No responses yet