May
05
2015

A quick overview over the project and setting up the basics of the space shooter game.

This game tutorial series will teach you how to create a simple top down arcade style shooter. The player will control a space ship, firing bolts to destroy enemies. The enemies are asteroids and enemy ships, also firing bolts. The level will endlessly spawn new waves of enemies randomly.

In this tutorial we’ll take a quick look at the project and set up some basics in the Makinom editor.

The Unity Project

By now you should’ve downloaded the project, unzipped it and opened it as a Unity project (i.e. don’t import it). You can open the project using the Unity menu: File > Open Project…

The project contains the following folders:

  • Finished
    The finished game, containing the complete Makinom project and all schematics, prefabs and the level.
  • Gizmos
    The Makinom gizmo icons.
  • Makinom
    The free version of Makinom.
    You can import the full version to replace it.
  • Tutorial Resources
    The resources the tutorial will be using, i.e. the ready to use level and prefabs that haven’t yet been set up for Makinom.
    The level is located in Assets/Tutorial Resources/.
    The prefabs are located in Assets/Tutorial Resources/Prefabs/.

Setting up Makinom

We’ll now set up some basics in the Makinom project. Open the Makinom editor (Window > Makinom) – this will create a new Makinom project at Assets/Makinom/Project.asset, in case no project has been created or opened yet.

Check if you’re working on a new project (i.e. not using the Finished Project) in Editor > About in the Project Summary. The Currently Loaded project should be Assets/Makinom/Project.asset, if not, please click on Create New Project and save it at this location.

Input Keys

First, we’ll set up the input keys to control the game. Navigate to Base/Control > Input Keys.

1: Horizontal

Select the Horizontal input key and do the following changes.

  • Input Origin
    Select Unity Input Manager.
  • Input Name
    Set to Horizontal.
  • Input Handling
    Select Hold.

We’re using the Unity Input Manager key instead of a key code to get smoother axis changes – which allows better player controls. Key code is only able to get us an axis of -1, 0 or 1.

2: Vertical

Select the Vertical input key and do the following changes.

  • Input Origin
    Select Unity Input Manager.
  • Input Name
    Set to Vertical.
  • Input Handling
    Select Hold.

5: Fire

Add a new input key – we’ll use it for firing the player’s weapon. Do the following changes.

  • Name
    Set to Fire.
  • Input Origin
    Select Key Code.
  • Positive Key
    Select Space.
  • Input Handling
    Select Hold.

That’s it for the input keys.

Game Object Pools

We’ll use pooling to reduce the amount of game objects created and destroyed during the game – you can learn more about pooling in this how-to.

The prefabs we’ll be using are already set up and are only missing the machines to add the game mechanics, so we can already use them for the game object pools.

Navigate to Base/Control > Game Object Pools and change the following settings.

0: Player Bolt

The first pool is for the player’s weapon firing bolts.

  • Name
    Set to Player Bolt.
  • Prefab
    Select Bolt.
    The prefab can be found at Assets/Tutorial Resources/Prefabs/.
  • Start Size
    Set to 5.
  • Can Grow
    Enable this setting.

1: Asteroid 1

Add a new pool for an asteroid.

  • Name
    Set to Asteroid 1.
  • Prefab
    Select Asteroid 1.
    The prefab can be found at Assets/Tutorial Resources/Prefabs/.
  • Start Size
    Set to 3.
  • Can Grow
    Enable this setting.

2: Asteroid 2

Add a new pool for an asteroid.

  • Name
    Set to Asteroid 2.
  • Prefab
    Select Asteroid 2.
    The prefab can be found at Assets/Tutorial Resources/Prefabs/.
  • Start Size
    Set to 3.
  • Can Grow
    Enable this setting.

3: Asteroid 3

Add a new pool for an asteroid.

  • Name
    Set to Asteroid 3.
  • Prefab
    Select Asteroid 3.
    The prefab can be found at Assets/Tutorial Resources/Prefabs/.
  • Start Size
    Set to 3.
  • Can Grow
    Enable this setting.

4: Enemy Ship

Add a new pool for the enemy ship.

  • Name
    Set to Enemy Ship.
  • Prefab
    Select Enemy Ship.
    The prefab can be found at Assets/Tutorial Resources/Prefabs/.
  • Start Size
    Set to 3.
  • Can Grow
    Enable this setting.

5: Enemy Bolt

Add a new pool for the enemy ship’s weapon firing bolt.

  • Name
    Set to Enemy Bolt.
  • Prefab
    Select Bolt Enemy.
    The prefab can be found at Assets/Tutorial Resources/Prefabs/.
  • Start Size
    Set to 3.
  • Can Grow
    Enable this setting.

That’s it for the game object pools.

Game Settings

Navigate to Game > Game Settings and change the following settings.

Initial Variables

Click on Add Variable to add a new variable. The variable will be initialized to a defined value when the game is started.

  • Variable Key
    Set to lives.
  • Type
    Select Int.
  • Operator
    Select Set.
  • Float Value
    Set to 3 (Value).

This variable will hold the player’s lives – when the player is destroyed, the variable is reduced by 1 and either respawn the player or cause game over. You can learn more about variables in this how-to.

That’s it for the game settings.

Music

Navigate to Game > Music and change the following settings of the Default Music.

  • Name
    Set to BGM.
  • Audio Clip
    Select music_background.
    The clip is located in Assets/Tutorial Resources/Audio/.
  • Loop Clip
    Enable this setting.

And that’s it – click on Save Settings to save the changes.

Scene Setup

Finally, we’ll add Makinom and the background music to the scene. Open the Level 1 scene (found at Assets/Tutorial Resources/).

Adding a Game Starter

To add Makinom to the game, we’ll need a game starter. You can learn more about game starters in this how-to.

Add the game starter using the scene wizard (Windows > Scene Wizard). Click on Add Game Starter, select the Makinom project if it’s not already selected (found at Assets/Makinom/Project.asset) and click on Add Game Starter again. The scene wizard will create a new game object and attach the game starter to it.

Move the new game starter object out of the way, e.g. to X=-10, Y=0, Z=0.

Adding the Music

Again, we’ll use the scene wizard to add the background music: Create Object > Music Player

Move the new music player object out of the way (e.g. X=-12, Y=0, Z=0) and change the following settings in the inspector of the Music Player component.

  • Play Type
    Select Play.
  • Music
    Select BGM.

And that’s it for now – save the scene.

The next tutorial will handle the player move controls.