
Shooty Shooty Ball Wall
The Shooty Shooty Ball Wall game was created in Unity using C# scripts and simple game objects to create the blocks, floor and "ammo".
The first thing i did was insert a simple spotlight to light up the floor to see what i was doing and to create a simple block game object. I then set the block to a prefab to create a wall four up and 5 wide using arrays and a coroutine to get basic targets setting the tag so i could call it later in the code for when it gets destroyed. I did this by setting the block height and width so that you can tell the engine how far you want each black from each other, which i chose to spread mine out so that there were a chance of missing when aiming at the next block. Using the array i then told the code i wanted it 4 high and 5 wide blocks wide so that it wouldn't go on forever i did this by saying once it has done 4x5 stop making blocks.
Bullet Not Script
I then added a first person rigid body controller and connected the main camera as a child of the controller. Next I created an "ammo factory" to create and fire balls. For the ammo factory i used on if Input.GetMouseButtonDown then add velocity to a clone of the original bullet in a certain direction which i made it go forward from where the character was facing. Then i made the "ammo factory a child of the camera so the player shoots the ball from a first person perspective and the factory follows where the person is facing.

Bullet Dead Script
After this i made the ammo disappear after 2 seconds, to keep the game clean, by using waitforseconds and the destroy gameobject after time. And then made sure that if the ball hit the block the block and ball would both be destroyed by calling back to the tags on the bullets and putting on the bullet script if other.gameObject.tag == ammo an then it checks what colour tag the block has on it and then change colour to the next.

Restart Script

Next i added some code to change the blocks so that if they get hit by a ball they change colours and then eventually disappear as well as adding in code for the score and timer. The code for the colour changing blocks works by looking at what colour the tag is when the ball hits the block and seeing in the code what happens next depending on the colour tag. So if the ball hits the block and the code looks at the tag attached to that block at that point lets say for example blue, it will look in the code for the blue tag and sees what happens when a blue tagged block is hit. For the timer i added a bit of code that says if time left = 0 then look through the block for all the different colour tags and then destroy them and this is so that when the timer finishes the game is no longer playable or the player could just keep playing until they win. Furthermore i added cross hairs on the same canvas as the score and timer to make aiming a bit easier.
Block Behaviour Script
To further difficult the game i made it so that if a green block (the last block colour the block will go) is destroyed then the score will reset to 0 and the block will disappear ending up with a lower score. I did this by saying if a green block is hit then set the score to 0 and destroy the green block.
Timer Script
To make it more of a game, i added a game over text that appears when the timer runs out and also made the timer to red at 5 seconds to warn the player. I did this by using the "time left" that i already had set up and said that if time left=5 then change the colour red. Also i created a new scene with "you win" in the middle of the screen that will appear when all the blocks are green that comes with a restart button. I linked the scene together by using Application.loadlevel("you win").
Bullet Maker Script

In my opinion my game went very well as it gave me the basic knowledge and experience that i needed to create more games in the future and as well as this was very easy to modify and customise after the game was finished and along the way. However one thing that i struggle to understand is arrays and how the work and why they work so i need to further educate myself on the area of coding as it will help me use them more often in future. However overall i think my game was a success yet there is much more to do with it and upgrade in the future.

Score Manager Script
