---
title: 05 Destroying Jewels
description: "Setting up the schematic to handle the destruction of a jewel. In this tutorial we'll create the schematic that's started (by a tagged machine on the individual jewels) when a jewel is destroyed. It'll handle animating the destruction (blinking and spawning a…"
url: "https://makinom.com/guide/tutorials/match-3/05-destroying-jewels/"
updated: "2020-12-19"
category: Match 3
---

# 05 Destroying Jewels

Setting up the schematic to handle the destruction of a jewel.

In this tutorial we'll create the schematic that's started (by a tagged machine on the individual jewels) when a jewel is destroyed. It'll handle animating the destruction (blinking and spawning a particle effect), increasing the player's score (the points of each jewel are stored in an object variable on the jewel) and destroying the game object.

In case you want to add special jewels (e.g. destroying a whole row/column or all nearby jewels), this is where you'd add the functionality, either directly in this schematic or creating new schematic and using them in the tagged machine on the jewel.

# Destroy Jewel: Schematic

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

[![](https://makinom.com/wp-content/uploads/makinom2_game_tutorial_match3_schematics_destroy_jewel.png)](https://makinom.com/wp-content/uploads/makinom2_game_tutorial_match3_schematics_destroy_jewel.png)

## Settings

We need a prefab resource for the particle effect.

### Prefabs

Click on *Add Prefab Resource* to add a prefab resource.

- **Prefab**
   Select *Destroy Particles*.
   The prefabs can be found at *Assets/Tutorial Resources/Prefabs/*.
- **Use Pooling**
   *Enable* this setting.

## Change Color

Add Node > Game Object > Renderer > Change Color

We'll use this node to start blinking the object by fading it's alpha (color) value.

- **Color Type**
   Select *Renderer*.
- **Fade**
   Select *Blink*.
- **Wait**
   *Disable* this setting.
- **Time (s)**
   Set to *0.25* (Value).
- **Fade Alpha**
   *Enable* this setting.
- **Fade Red/Green/Blue**
   *Disable* these settings.
- **Start Color**
   Set to *R=0, G=0, B=0, A=255*.
   Depending on the used color picker range, this can also be *A=1*, you basically want a full alpha value color.
- **End Color**
   Set to *R=0, G=0, B=0, A=0*.

### Game Object

- **Object**
   Select *Machine Object*.

## Wait

*Add Node > Base > Wait*

We'll wait for 0.5 seconds to give the game object some time for blinking.

- **Time (s)**
   Set to *0.5* (Value).

## Spawn Prefab

*Add Node > Game Object > Prefab > Spawn Prefab*

Now, we'll spawn the particle effect.

- **Prefab**
   Select *Prefab 0: Destroy Particles*.
- **Target Type**
   Select *Object*.

### Target Object

- **Object**
   Select *Machine Object*.

## Destroy Prefab

*Add Node > Game Object > Prefab > Destroy Prefab*

Next, we'll destroy the particle effect (after 1 second).

- **Prefab**
   Select *Prefab 0: Destroy Particles*.
- **Spawned Prefab ID**
   Set to *-1*.
   This will destroy all spawned instances of the prefab.
- **Destroy After Time**
   *Enable* this setting.
- **Time (s)**
   Set to *1* (Value).
- **Wait**
   *Disable* this setting.

## Play Sound (Channel)

*Add Node > Audio > Audio > Play Sound*

We'll play a destruction sound.

- **Audio Clip**
   Select *Select Audio Clip* and *destroy_jewel*.
   The audio clip can be found at *Assets/Tutorial Resources/Audio/*.
- **Wait**
   *Disable* this setting.
- **Play One Shot**
   *Disable* this setting.

## Wait

*Add Node > Base > Wait*

We'll wait for 0.25 seconds for the particle effect and audio to play a bit before destroying the game object. Also, this allows the blinking to fade from full alpha to no alpha (due to blink duration of 0.25 and already having waited for 0.5 seconds).

- **Time (s)**
   Set to *0.25* (Value).

## Change Variables

*Add Node > Value > Variable > Change Variables*

We'll use this node to increase the player's *score* (global int variable) by the *points* of the jewel (object int variable on the jewel).

Click on *Add Variable* to add a variable change.

- **Change Type**
   Select *Variable*.
- **Variable Key**
   Set to *score*.
- **Variable Origin**
   Select *Global*.
- **Type**
   Select *Int*.
- **Operator**
   Select *Add*.
- **Float Type**
   Select *Variable >**Int Variable*.
- **Variable Key**
   Set to *points*.
- **Variable Origin**
   Select *Object*.
- **Object**
   Select *Machine Object*.

## Destroy Object

*Add Node > Game Object > Game Object > Destroy Object*

Finally, we'll destroy the machine object (jewel).

### Destroy Object

- **Object**
   Select *Machine Object*.

And that's it for the schematic - click on *Save Schematic* and save it as *DestroyJewel* in *Assets/Schematics/*.

The next tutorial will handle the [game controls](https://makinom.com/guide/tutorials/match-3/06-game-controls/).
