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
  • Match 3
  • 07 Jewel Setup

07 Jewel Setup

Table of Contents
  • Setting up the prefabs
    • Object Variables
    • Jewel Click: Interaction Machine
      • Start Settings
      • Machine Execution Settings
      • Condition Settings
    • Destroy Jewel: Tagged Machine
      • Start Settings
      • Machine Execution Settings
  • Testing

Stetting up the jewel prefabs.

In the last tutorial we’ll set up the jewel prefabs. We’ll add an Object Variables component storing the points the player gets when destroying a jewel, an Interaction Machine for playing the Jewel Click schematic and a Tagged Machine for handling the jewel’s destruction.

Setting up the prefabs #

The setup for all jewel prefabs is the same. The following component setup can be repeated for all jewel prefabs, or you can just copy the components and paste them on the other jewels.

You can copy a component by right-clicking on the component’s name and selecting Copy Component in the context menu. To paste the component on a game object, right-click on any component’s name and select Paste Component As New in the context menu.

The jewel prefabs (blue, green, purple, red and yellow) can be found at Assets/Tutorial Resources/Prefabs/.

Object Variables #

First, we’ll set up the object variables of the jewels. Add an object variable component to the prefabs (e.g. using the component menu: Makinom > Scenes > Object Variables). Change the following settings.

  • Local Variables
    Enable this setting.
  • Always Initialize
    Enable this setting.

Click on Add Variable to add an object variable.

  • Variable Key
    Set to points.
    Select the Value string type.
  • Type
    Select Int.
  • Operator
    Select Set.
  • Float Value
    Set to 10 (Value).

Jewel Click: Interaction Machine #

Next, we’ll add the Jewel Click schematic using an interaction machine component. The schematic handles the game controls, swapping jewels and searching/destroying matching jewels.

Add the component to the jewel prefabs (e.g. using the component menu: Makinom > Machines > Interaction Machine). Change the following settings.

Start Settings #

  • Start
    Mouse Down this setting.

Machine Execution Settings #

  • Schematic Asset
    Select JewelClick.
  • Execution Type
    Select Blocking.
    A blocking machine prevents all other blocking machines from starting – only one blocking machine can execute at a time.
    This makes sure the player can’t click on another jewel while the game is swapping, destroying or moving jewels (since this is all caused by the JewelClick schematic).
  • Update Type
    Select Update.
  • Stop On Destroy
    Disable this setting.

Condition Settings #

Click on Add Condition, we’ll set up the game state condition here.

  • Auto Check
    Select None.
  • Needed
    Select All.

In the added Condition 0, we’ll set up our game state condition.

  • Condition Type
    Select Game State.

Click on Add Game State.

  • Condition Type
    Select Game State.
  • Game State
    Select In Control.
  • Check State
    Select Active.

Destroy Jewel: Tagged Machine #

Destroying jewels is handled by the DestroyJewel schematic – which is started through a tagged machine on each jewel. In case you want to add special jewels that do something else upon being destroyed (e.g. destroy a whole row or column of jewels), you can create a different schematic and use it in this tagged machine.

Add a tagged machine component to the jewel prefabs (e.g. using the component menu: Makinom > Machines > Tagged Machine) and change the following settings.

Start Settings #

Click on Add Starting Tag to add a starting tag

  • Tag
    Set to destroy.

Machine Execution Settings #

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

And that’s it – we don’t need to apply the changes, since we’ve been working on the prefabs directly.

Testing #

Click on Play to test the game. You can now select and swap jewels by clicking on them – if matches are found after swapping jewels, they’ll be destroyed, leading to jewels above falling down, etc.

The player’s score and turns increase and are displayed by the HUD.

This concludes the match 3 game tutorial series. You can add additional content to the game, e.g. new levels, new jewels or new game modes (e.g. only having a defined amount of turns and having to reach a certain score).

Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on December 19, 2020
Table of Contents
  • Setting up the prefabs
    • Object Variables
    • Jewel Click: Interaction Machine
      • Start Settings
      • Machine Execution Settings
      • Condition Settings
    • Destroy Jewel: Tagged 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!