Getting more organized

This week we’ve restructured almost the entirety of our project, and cleaned up a lot of code and assets that were not needed/badly organized.

After a while, assets start piling up, creating redundancy. This can lead to wasted time (while searching for the right assets from perhaps five similarly named yet different assets) and space (obviously). While it takes time to do the cleanup, it eventually gets to the point where it is more efficient to do the cleanup than to leave them be.

How to do the cleanup? It’s simple. Find and delete all un-used assets! Since I’m the programmer, I focused on code cleanup. Any code that wouldn’t be used at all was deleted. Anything with inefficient code was re-coded, keeping the useful parts, deleting the parts that weren’t used, and changing the parts that can be better coded.

To do most of the cleanup, we decided to create a new unity project and move everything over bit by bit, making sure that everything works properly at every step, and then cleaning it up afterwards.

While doing this, we noticed a number of small inconsistencies that were fixed, and we got a good overview of our game design as well. This made us realize that we needed to change some things around to make sure that the game was actually engaging, which was great.

Something we noticed while reimplementing the movement and shooting mechanics of the moth, is that we really needed to redesign it. We started with thinking about what we really wanted out of the mechanic of shooting. We realized that we probably needed mouse aiming for the shooting.

I implemented the mouse aiming by first getting a direction vector by using vector subtraction of the mouse-position with the players position:

jl8vh
Vector Subtraction (for real this time, thank you, Sill)

You get the direction and distance between two points (defined as vectors) by subtracting one from the other.

 

I then normalize that vector, which sets it’s length to 1. I do this so that when I multiply it with the bullets speed later, it will have a consistent speed.

I then spawn an instance of the projectile object with that direction vector as the velocity for it.

About Erik Wallin

2016 Programming