Cuppa Team - Developing the Game (Code)


I started off the coding side of the game in C# by developing it based off a Unity tutorial called: Space Shooter Tutorial ( It seemed relatively similar to how we envisioned our game being once it was finished so I figured it would be a good basis to start from. To our luck our lectures had examples on how to create a simple space shooter game as well, slightly different from the tutorial that I had already been following so I attempted to merge them both together, introducing the lecturers versions of some of the gameplay into the unity tutorial one, depending on which way the team and I preferred the mechanics to work for our game. Below is one of the first videos I took after I started to merge this code together, as you can see it worked but it was very buggy! (


My initial idea of merging two completely different game codes together seemed genius, but resulted in a lot of clashing code and meant that I had to spend a lot of my time debugging! This was done mainly by looking at the games console log and seeing what errors were occurring, such as if a variable was being assigned but not used, or if a script had a syntax error that stopped it running completely.

This game had an empty GameObject to hold the game controller script that handled the spawning of the enemies and meteors as well as listening for functions such as the score being updated which was handled in another script. Having a lot of cross referencing with scripts did mean that, if I had been working on my other projects and hadn't kept myself familiar with this one, that I would forget the structure of it all and how certain behaviours were coded, as well as what line of coded effected what in a completely different script. This could become very frustrating! By having many public variables I was able to easily drop and drag the right assets in, which also made life easier when it came to drop in the assets that the rest of the team were busy building.

As you can see, I also use commenting to help me debug. Any code that is not needed anymore or that I thought could have been throwing an error was simply commented out, meaning that it would not effect the gameplay anymore. I kept a lot in just in case I needed to uncomment it again. In the future I should tidy this up before final build.

It was very important while developing this game that I was tagging each asset correctly as this helped to reference the right object in the code. This was especially useful when coding the score system as it checked to see if the object that collided with it was a bullet and if it was then it ran the updatescore function.

You Might Also Like


Popular Posts

Follow me on Twitter

YouTube Channel