GameDev : Asteroid (Part I)!

Matteo Lo Piccolo
3 min readJun 29, 2021

To make things a little more “difficult”, let’s now create an Asteroid which, after being hit and destroyed, start the wave of Enemies!

It’s not so complicated, but is a good exercise to create new mechanics and make it functional in the Game!

And we start to think to how solve this type of problems!

Every times we start with simple mechanism : we need to hit Asteroid for starting waves, so drag the Asteroid into the Scene.

Give it a starting position, like this

And maybe a little rotation over time

As we see, we need to rotate it on Z Axis.

To set up Asteroid, we need a Circle Collider 2D (edit it a little because is too big), and we need the Rigidbody 2D for collision with Laser.

Set gravity to 0 and check the Trigger toggle

Now that we have set up the Asteroid in scene, create the behaviour for it

And attach it

Open the script.
First, because we need a starting position, I prefer cash it.

To rotate it

transform.Rotate() is a good method.
It’s not the only one, but to make the Asteroid rotate in one direction I think is a easy and fast way.
No need something incredible here, a simple rotation over time.

This is the first step, in the next we make the Asteroid EXPLODE!!



Matteo Lo Piccolo

Always in love with programming, even if late (I'm already 39 years old) I decided to follow my dream! We will see how far my passion will take me!