While each of the power up should work for a short time, how should we decide? The old way was to guess and let it run and go back into the code and change it for there? Or is there a way to change inside the inspector window and tweak it until it looks right?

Why, yes I say there is a way. By using the [SerializeField], allows you to code to connect to the inspector window. By using the code that controls the object that is needed, you can also use it for the spawner.

Then you can tinker by putting in a new time of number until you find the right one.

So that is how I figured out the length of time a power up should last.

--

--

Now we have started to get our game looking like a game. I have added the 2D Sprites to the game’s player, enemy, and the background.

All we had to do was change the rigidbody to 2D Rigidbody and 2D box colliders. For the enemy script we had to change the OnTriggerEnter(Collider other) to OnTriggerEnter2D(Collider2d other) and volia we have ships, we have firing ship and enemies. Now we need to make collectable helps to help us defeat our enemies.

NEXT TIME: How to create animated sprites and more.

--

--

Spawning objects like they are falling without using the power of tons of if else statements calls for a Spawn Manager. What is a spawn manager? It is a bunch of code using the IEnumerator method and private void. You can create a container to hold enemies and they will spawn random without messing with long handle codes of telling them to pop up in certain spots.

We use coroutines so that they help us keep up with how many objects can spawn and how few that they will allow through each spawning point.

--

--