I am old enough to remember the very 1st shoot ’em up games that i would occasionally play at local arcades, Costing me about 10p a go. Space invaders, Galaxian and Centipede were some of my favourites. Now almost 40 years later I’ve decided to create my own. When looking for a way to make games i had downloaded many many games creation software and didn’t seem to get anywhere very quickly,  I had download the program Unity a long time ago, But found it too complicated as a beginner. So i gave up. About a year later i decided to look at the end results and possibilities of each games engine and then made my decision based solely on that. Unity seems to be able to make many game styles and with scripting the possibilities seem endless. It is also Free as are the other programs i will be using, Those are :


Part 1

The players spaceship

To begin  you want a spaceship like this, right click to save and place it into your Unity assets folder

Spaceship1

 

 

this was created with blender and then rendered as a png file, to keep the areas around it transparent. I have also created 12 images that will be attached underneth the ships rocket that will produce a Fire/Jet animation.

But for now lets just add this sprite into Unity.

Because mostly all shoot ’em up games are located in outer space, click on your main camera and change the background to black. Also move your spaceship sprite to the bottom middle of the main camera.

Moving a 2D sprite, left and right:

now we want this ship to move around the screen, To begin we will just get it to move left and right. So now create a CSharp script and rename it Spaceship then with your ship sprite selected drag and drop this script into the inspector panel.

now open the script in monodevelop & paste in this code:

using UnityEngine;
using System.Collections;

public class Newship : MonoBehaviour {

    public float speed;
    void Start () {
    
    }

    void Update () {
        if (Input.GetKey(KeyCode.LeftArrow))
        {
            transform.position += Vector3.left * speed * Time.deltaTime;
        }
        if (Input.GetKey(KeyCode.RightArrow))
        {
            transform.position += Vector3.right * speed * Time.deltaTime;
        }
    
    }
}

this code is very basic and may later be changed to smooth out the movements but for now your ship should move left and right, if not, make sure you typed in a number into the box next to where it says speed in the inspector, 5 seems an ok speed.


Part 2

Background

Now to give the player the feeling that they are moving forward, we will make a star field background that moves downwards.

From the top list go to: Gameobject / Particle System
you should then see this Particle added to your scene.
In the transform section change its X rotation to zero.
In the particle section change its shape to Edge, you will notice that there is now a blue horizontal line with points on either side.
Drag one of these points until the particle system covered the width of the camera. If it is not in the middle change its X position to zero.
You will also need to change the Y position until it is just outside the top of the camera view.
Now you need to rotate it by changing the Z rotation to 180, so now the particles should be falling downwards.
Click the box next to Prewarm.

Now if you press play you will see a falling particle system, that currently looks like its snowing.

Reduce the Start Size until you are pleased with the size you want.
Decrease the Start speed and increase the Start Lifetime.
Thats it, you should now have a nice falling stars effect, To make it look even better copy this whole particle system inside the Hierarchy area and alter the size, speed and lifetime until you are pleased with the result. Two particle systems falling at different speed will give your background more depth.

 

More Soon!

Unity Games Engine