In this video, I will teach you how to make a space shooter in Unity. It is a sequel to the previous tutorial, but it includes some additional parts, like how to add a bullet shooting feature and how to make a better movement for the rotating object.
To make a space shooter, you need to create a bullet object that will also be a triangle, but will be smaller. You should set its color to white in order to make it clearly visible. But that is not sufficient! You also need a spawn object, and the triangle bullet should have a 2D rigidbody. Make sure to make a prefab of this object. Now you should go back to the C# script:
Add a reference to the game object – call it arrowObject. Add a public transform spawnObject and the last thing you need to have is a shooting speed, which is a float.
Drag the prefab and add the shooting speed. As you can see, the prefab does not spawn well. It does not have the required gravity direction. To fix that, go to script and add Physics.gravity to the spawnObject.forward and change force mode to force. This will apply gravity to different rotations of the triangle.
You can also customize the scene with your own assets (download them in description) and experiment with the values!
Support the Creator of Kozmobot on the social networks!
CHECK OUT MY WEBSITE: http://kozmobot.com
INSTAGRAM: https://www.instagram.com/kozmobot.channel
TIKTOK: https://www.tiktok.com/@kozmobot.channel
Voir sur youtube