Makinom - Game Toolkit for Unity
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom

Guide

Schematics

  • Setting the Player
  • Simple Character Controller
  • Mouse Orbit Camera
  • Random Waypoints

Breakout

  • Breakout Tutorial Introduction
  • 01 First Steps
  • 02 Player Controls
  • 03 Bricks
  • 04 Losing a Life
  • 05 UI Setup
  • 06 Sound Assignments

Space Shooter

  • Space Shooter Tutorial Introduction
  • 01 First Steps
  • 02 Player Move Controls
  • 03 Player Weapon Controls
  • 04 Hit and Destroy
  • 05 Asteroids
  • 06 Game Controller
  • 07 UI Setup
  • 08 Player’s Destruction
  • 09 Enemy Ship Mechanics
  • 10 Enemy Ship
  • 11 Moving the Background

Match 3

  • Match 3 Tutorial Introduction
  • 01 First Steps
  • 02 UI Setup
  • 03 Generating the Level
  • 04 Matching Jewels
  • 05 Destroying Jewels
  • 06 Game Controls
  • 07 Jewel Setup

Survival Shooter

  • Survival Shooter Tutorial Introduction
  • 01 First Steps
  • 02 Player Movement
  • 03 Player Shooting
  • 04 Enemy Mechanics
  • 05 Setting up the Enemies
  • 06 UI Setup
  • 07 Player’s Death
  • 08 Enemy Spawner

2D Roguelike

  • 2D Roguelike Tutorial Introduction
  • 01 First Steps
  • 02 Generating the Level
  • 03 Level Generation Machines
  • 04 Player Controls
  • 05 Walls, Food and Exit
  • 06 Game Manager and UI Setup
  • 07 Enemy Mechanics
  • 08 Game Over

2D Platformer

  • 2D Platformer Tutorial Introduction
  • 01 First Steps
  • 02 Player Movement
  • 03 Camera and Background
  • 04 Shooting Rockets
  • 05 Enemy Mechanics
  • 06 Setting up the Enemies
  • 07 Enemy Spawners
  • 08 Player Damage and Fall Remover
  • 09 Health Pickup
  • 10 Bomb Pickup
  • 11 Bomb Prefabs and Lay Bombs
  • 12 Pickup Spawner
  • 13 UI Setup
  • 14 Background Animations
  • Home
  • Guide
  • Tutorials
  • 2D Platformer
  • 07 Enemy Spawners

07 Enemy Spawners

Table of Contents
  • Spawner: Schematic
    • Settings
      • Prefabs
    • Wait
    • Emit Particles
    • Spawn Prefab
      • Target Object
    • Chance
    • Start Tagged Machine
      • Machine Object
      • Starting Object
      • Tag Settings
    • Restart Schematic
  • Spawner: Auto Machine
    • Start Settings
    • Machine Execution Settings
  • Testing

Setting up enemy spawners.

In this tutorial we’ll set up a schematic spawning enemies and 3 machines playing the schematic. When an enemy is spawned, a particle effect (flash) is played.

Spawner: Schematic #

First, we’ll create the schematic spawning the enemies.

Open the Makinom editor, navigate to Schematics and create a new schematic. Change the following settings.

Settings #

We’ll add the 2 enemy prefabs as a prefab resource.

Prefabs #

Click on Add Prefab Resource to add a prefab resource.

  • Name
    Set to Enemy.
  • Use Order
    Select Random.

We’ll use 2 prefabs, so add another one by clicking on Add Prefab.

  • Prefab
    Select enemy1 and enemy2.

Wait #

Add Node > Base > Wait

We’ll wait for 2-5 seconds before spawning an enemy.

  • Random
    Enable this setting.
  • Time (s)
    Set to 2 (Value).
  • Time 2 (s)
    Set to 5 (Value).

Emit Particles #

Add Node > Game Object > Component > Emit Particle

We’ll use this node to emit the spawning particles – the particle effect is placed on a child object of the spawner game object we’ll be using.

  • Emit
    Enable this setting.
  • Stop Before Start
    Enable this setting.
  • Object
    Select Machine Object.
  • Scope
    Select In Children.

Spawn Prefab #

Add Node > Game Object > Prefab > Spawn Prefab

We’ll use this node to spawn one of the enemy prefabs.

  • Prefab
    Select Prefab 0: Enemy.
  • Target Type
    Select Object.

Target Object #

  • Object
    Select Machine Object.

Chance #

Add Node > Base > Chance

This step is used to play the next node based on chance ranges. We’ll use it to have a 50 % chance that the enemy will face left after spawning.

Each Chance Range you add to the node will have it’s own next slot – the first chance range that contains the randomly generated chance number (by default between 0 and 100 – this can be changed in Game > Game Settings in the Chance Settings) will continue the schematic.

  • Minimum Range
    Set to 0 (Value).
  • Maximum Range
    Set to 50 (Value).

Start Tagged Machine #

Add Node > Machine > Start Tagged Machine

We’ll use this node to flip the enemy (i.e. face left).

This node is connected to slot 0 of the Chance node.

  • Share Local Variables
    Disable this setting.
  • Wait
    Enable this setting.

Machine Object #

  • Object
    Select Prefab 0: Enemy and set to -1.

Starting Object #

  • Use Same Object
    Enable this setting.

Tag Settings #

Click on Add Tag to add a starting tag.

  • Tag
    Set to flip.

Restart Schematic #

Add Node > Machine > Restart Schematic

This node is used to restart the schematic in the next frame. It’ll keep the schematic running without having to stop and start again via a machine component.

This node is connected to the Failed slot of the Chance node and the Next slot of the Start Tagged Machine node.

And that’s it for the schematic – click on Save Schematic and save it as Spawner in Assets/Schematics/.

Spawner: Auto Machine #

Now we’ll add the Spawner schematic using an auto machine to the spawner game objects in the scene. The spawner game objects are the 3 child objects of the spawners game object in the scene.

The machine component setup is the same for all 3 spawner game objects, so you can either repeat the setup or copy/paste the components on the other spawners.

Add an auto machine component to the spawner game objects (e.g. using the component menu: Makinom > Machines > Auto Machine) and change the following settings.

Start Settings #

  • Start
    Enable this setting.

Machine Execution Settings #

  • Schematic Asset
    Select Spawner.
  • Execution Type
    Select Single.
  • Update Type
    Select Update.

And that’s it – don’t forget to save the scene.

Testing #

Click on Play to start the game. The enemies will now spawn from the 3 spawn points in the sky with random times between 2 spawns.

The next tutorial will handle player damage and the fall remover (removing everything that falls into the river).

Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on January 7, 2021
Table of Contents
  • Spawner: Schematic
    • Settings
      • Prefabs
    • Wait
    • Emit Particles
    • Spawn Prefab
      • Target Object
    • Chance
    • Start Tagged Machine
      • Machine Object
      • Starting Object
      • Tag Settings
    • Restart Schematic
  • Spawner: Auto Machine
    • Start Settings
    • Machine Execution Settings
  • Testing
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom
  • Contact
  • Blog
  • ORK Framework
  • gamingislove.com
Categories
  • Makinom 1 (97)
    • Tutorial (97)
      • 2D Platformer (14)
      • 2D Roguelike (8)
      • Breakout (6)
      • How-to (34)
      • Match 3 (6)
      • Schematic (4)
      • Scripting (6)
      • Space Shooter (11)
      • Survival Shooter (8)
  • News (11)
  • Release (68)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!