game two


for game two i was tasked with creating a space invaders prototype i think that this was significantly harder to create than the cookie clicker game however i personally think that it was far more interesting as there was at lot more challenge to it overall the game prototype was far more fleshed out that the cookie clicker because it involved adding physics into the mix it also involved quite a bit more involvement with the unity engine as a whole such as editing the keyboard inputs

the first of three major scripts for the space invaders clone involved making the player character able to move which involved adding parameters to the horizontal axis and locking the vertical axis so that the player can only move left and right a lot of the first code was mostly trying to help the game figure out which axis it had to move on and at what speed which took up quite a big chunk of time as there was quite a few errors that turned up whilst I was writing the code so i did have to spend a good amount of time fixing said errors but once i had fixed the errors the only thing that was remotely an issue with the code was that it made the player sprite move a bit too fast but that was easily fixable

the second script that i had to make was so that the player sprite could shoot bullets the very beginning was quite a bit similar to setting up the player model as both required me to add a rigid body after that i had to write a script that made it so that when fired the bullet will travel upwards so that it can shoot the enemies. the next part of that code was making it so that when you pressed the key assigned to jump which in my case was the space bar a bullet shot, that was quite a difficult thing to do because i needed to make sure that everything was both spelled correctly and made sure that all of the code worked the way it was supposed to however once i had completed the code and correctly got it working the bullets moved far too fast, like with the player sprite, so then i had to implement a string of code that limited the rate of fire so that it was slower.

the final script that in made was the script for the enemy which in most things was a mixture of the bullet script and the player character script because it used the same script as the bullet to move in a single direction but instead of only moving up i edited the script so that it moved the enemy, the next part of the script mad it so that once the bullet had collided with the enemy hitbox it would both destroy the current enemy and then respawn the enemy back the next problem was that the enemy would only ever respawn in the same spot so i had to use script that randomized spawn locations from a set of pre selected axis which made it so that the enemy no longer kept respawning in the same place over and over again.

the final thing that i did with this game was make sure that if i added multiple different enemies they still both moved about and respawned and after another decent bit of trial and error i managed to successfully get multiple enemies working.

the things that i learned from making this prototype was the various different coding that used vectors which yes were not all that different but it still made for good practice i also learned how to make things respawn and how to make hitboxes work successfully


Leave a Reply

Your email address will not be published. Required fields are marked *