From Prototype to Work of Art
In the previous articles, we learn how to move our Player, shot a laser, spawn our enemies and destroy them. It’s time to transition from the prototyping stage to the production stage. What this means is that we will use some 2d assets to make our project look like a game.
First, let’s change our background. We need to add a sorting layer, so our player and enemies won’t hide behind our background:
Next is the Player:
In the prototyping stage, I used a cube as our Player. Now, I need to convert it to a sprite. The Player had a Box Collider attached. Because a sprite is a 2D GameObject, we need to use Box Collider 2D. Remember that “isTrigger” needs to be checked. Add a new sorting layer and called it “Foreground”.
The same thing we will need to do to our enemy:
Also, our enemy needs a Rigidbody 2D to detect collisions:
It’s time for a laser:
The last thing you need to remember is to change the enemy script: