Day 6 — Git Good or Die!
This weekend I was able to complete the Galaxy Shooter Extras and I started the Phase 1: Frameworks. Prior to jumping into Frameworks I decided, since I was spending extra time on the weekend and had made good progress my first week to also complete the GIT Crash Course and get familiar with GITHUB. I know it is not required for beginners but I really wanted to stay true to Jonathan’s original vision and order for the 2D Course Material. After spending a couple of hours practicing with Git Bash I feel very comfortable now with setting up Repositories, Branches and using Pull, Commit and Push. For my needs right now it will be fairly simple as I will just be working out of the DEV Branch; Adding files, “Commiting” my changes after each feature and Pushing to the Origin server each time.
For Phase 1: I was able to successfully implement my thruster acceleration as I hold the left SHIFT key. Rather than just multiplying my speed when the button is held I opted to accelerate gradually over time to the Max speed while the button is held down. See Code below:
As the LeftShift key is held down the player, gently accelerates to the top Max speed using velocity which is calculated by acceleration multiplied by Time.deltaTime. As you can see in the code, I also capped the Velocity to the Max Speed I assigned so as to not accelerate indefinitely. I then had the velocity reset to 0 when the Left Shift key is released.
While researching my solution I did come across acceleration and deceleration using Rigidbody’s Addforce mechanics but it involved using FixedUpdate and I decided that was outside of the scope for this project and not necessary for what we needed to do. That being said, I am very intrigued and look forward to exploring Unity’s Physics engine when the time is right; I can surmise how powerful this tool will be in a 3D environment.
On Friday I thought I was almost done with the 2D Space Shooter and was sad that it was finishing up but I was pleasantly surprised the next day when I got to Phase 1 and Phase 2. There are a lot of fun features to implement and absolutely no information or code to start you out. It really forces you to do your own research and figure it out without any hand holding. I love it!
Mark