Last week I made a main menu for my game. It wouldn’t let me post in the other room for some reason. To do this I had to create a new scene and call it menu.
To make my menu I used Unity’s UI system. I have already done a post on this ages ago as you know, but I did it differently this time. To create the Menu I added a button which automatically came with a canvas to put it on. I made a quick background in Photoshop for the menu. To add the image I had to drag the image into the assets folder. I then added the image as a raw image sprite.
The button I added was going to the Start button for the game so I renamed it to “Start Game”. I added using UnityEngine.SceneManagement; which added new types of code that allowed me to switch between scenes.
After the Menu was done I added more components to the ship. I created a new float variable (decimal number) called engine power = 3f. This was how fast the ship went. I made another float variable called rotationPower which determined the amount of power in the ship’s speed.
Next I created a collision component, which made the game restart whenever the ship hit an asteroid. This required making a 2D rigid body. I made some code which basically said, if the ship collides with an object it will restart the level. After that I created another asteroid and colours it green. This made the ship go to the next level.
For the first level I created a quick background sprite and added it to the scene.
Lastly I added all the scenes to my build which meant all the scenes will in order.