After implementing the general movement code, I then set out to make the ball and goal collision, and spawning of the exit gate upon collision. I also tidied up the tutorial level and added on screen text help which guides the user through the initial controls.
Firstly, I wanted to add a manual restart button when the user pressed a certain key. To do this, instead of adding to the original player behaviour code, I decided to create a new one so it doesn’t get confusing to edit the code in the future.
To test if there was a collision between the ball and the goal, I used Debug.Log to display a message in the console. After the code worked, I then added the code for the ball to be destroyed and the gate to be spawned in.