> For the complete documentation index, see [llms.txt](https://doc.playturbo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.playturbo.com/playable-tools-content-editor/content-editor-creation-tips-center/common-creation-tips/creation-tips-event-setting.md).

# Creation Tips - Event Setting

## 📒<mark style="color:blue;">Global Variable Calculation for Interactions - Different Layers</mark>

### <mark style="background-color:orange;">1.Application Scenarios</mark>

**Achieving the effect of "multiple interactions, where each click/drag on different layers triggers the same or different feedback."**  Here are some examples:

* Example 1: After clicking and finding 5 target items, redirect to the app store.&#x20;
* Example 2: After successfully dragging all 3 puzzle pieces to the correct positions, a "Next Level" button appears as an indication.
* Example 3: For each group of elements eliminated, the progress bar advances, and after completing 3 groups of eliminations,  redirect to the next scene.
* ... ...

### <mark style="background-color:orange;">2.Case Preview</mark>

We will use the template "Find Items" as an example  to create a simplified version and focus on explaining how to achieve this type of gameplay using Global Variables.

[Simplified Version](http://tinyurl.com/4jhuxj4s) Gameplay Process:

* Click on the screen to find cats.
* Each time a cat is found, play a star particle feedback and increment the count of found cats.
* After finding three cats in total, redirect to the end page.

<div align="left"><figure><img src="/files/FtTQXGJywB3ehHCkP849" alt=""><figcaption></figcaption></figure></div>

### <mark style="background-color:orange;">3.Step-by-Step Explanation</mark>

Creating this type of gameplay requires three steps: adding a numeric variable、assigning the value to each element、and adding Conditions to calculate interaction counts.

#### <mark style="color:red;">**Step 1:  Add Global Variables**</mark>

* Click on \[Global Variables] - \[Add variables]
* Enter the variable name (such as click times)
* Select variable type as \[Value]
* Set the initial value to 0（At the initial screen, the player has not yet clicked.）
* Save

<figure><img src="/files/XJexxUQBRcBWukPo2xvm" alt=""><figcaption></figcaption></figure>

#### <mark style="color:red;">**Step 2: Assign the value**</mark>

* Select the layer \[cat1] - \[Add Event] - \[Press]
* <mark style="color:red;">\[Add response event] - \[Assign the value]: clicktimes+1</mark> (i.e. press a cat and the number of clicks will increase by 1)

<div align="left"><figure><img src="/files/gVmUmBl3forCxLI2Nlle" alt=""><figcaption></figcaption></figure></div>

* Continue to add response events - \[Show layer] cat1 -  \[Hide layer] star1
* After adding, we click the \[Copy] button to copy the entire event

<figure><img src="/files/IU34MRQbMjiL5cexS4GB" alt=""><figcaption></figcaption></figure>

* Then paste them into layers \[cat2] and \[cat3] in sequence, and change the corresponding effective layers to cat2/star2, cat3/star3

<figure><img src="/files/6AUs34loweArVmZQGTvp" alt=""><figcaption></figcaption></figure>

#### <mark style="color:red;">**Step 3: Add Condition**</mark>

* Click on \[Event] in the **current scene** - \[Add Event] - Select \[Condition] - \[+Condition]
* <mark style="color:red;">\[Add condition 1] : clicktimes=Value 1, and check \[Valid only once]</mark>（When the interaction count equals 1.）

<div align="left"><figure><img src="/files/FTqCLqJAp9VWQqwAmAZC" alt="" width="563"><figcaption></figcaption></figure></div>

* \[Add response event] - \[Show layer] text\_1 - \[Hide layer] text\_0

<div align="left"><figure><img src="/files/RQ1k7n72rsYiOIe0vt6R" alt=""><figcaption></figcaption></figure></div>

* Similarly, continue to add two conditions: **clicktimes=2**（When the interaction count equals 2.）、**clicktimes=3**（When the interaction count equals 3.）
* And sequentially add response events: Show text\_2\&Hide Text\_1、Show text\_3\&Hide Text\_2
* <mark style="color:red;">**Note:**</mark> Because we want to achieve "redirect the end page after finding three cats", we need to add an additional response event - Redirect to the next scene in Condition 3 (i.e. when the number of clicks=3) (execution delay of 0.5 seconds is the reserved particle playback time)

<figure><img src="/files/GhFB8VGeMA2xFRP0sqWw" alt=""><figcaption></figcaption></figure>

With these steps, the event setup is complete. When you encounter a need to **"calculate the interaction count on different layers to trigger specific feedback,"** you can try applying this logic and method in your own projects!

## 📒<mark style="color:blue;">Global Variable Calculation for Interactions - Same Layers</mark>

### <mark style="background-color:orange;">1.Application Scenarios</mark>

**Achieving the effect of "multiple interactions, where each click/drag on the same layer triggers the same or different feedback."** Here are some examples:

* Example 1: On the first click on the wheel, it stops at position A. On the second click, it continues from position A and stops at position B.
* Example 2: Clicking the "Generate" button results in the appearance of a new character with each click.
* Example 3: Clicking an item produces the same particle effect or other feedback with each click.
* ... ...

### <mark style="background-color:orange;">2.Case Preview</mark>

&#x20;Gameplay Process of [This Case](https://tinyurl.com/26cnjbb3):

* The initial state has the wheel stopped at the red position.
* On the player's first press, the wheel rotates to the purple position and stops.
* On the player's second press, the wheel continues rotating from the purple position and stops at the cyan position.

<div align="left"><figure><img src="/files/h3wG4DwObzYE5qCmUZW2" alt=""><figcaption></figcaption></figure></div>

### <mark style="background-color:orange;">3.Step-by-Step Explanation</mark>

Creating this type of gameplay requires 2 steps: aadding a numeric variable、adding Conditions and assigning the value to the layer events.

#### <mark style="color:red;">**Step 1:  Add Global Variables**</mark>

* Click on \[Global Variables] - \[Add variables]
* Enter the variable name (e.g., tap).
* Select variable type as \[Value]
* Set the initial value to 0（At the initial screen, the player has not yet clicked.）
* Save

<div align="left"><figure><img src="/files/BfMADoocNfMxZoTIzca5" alt=""><figcaption></figcaption></figure></div>

#### <mark style="color:red;">Step 2: Add Conditions and Assign the value</mark>

* Select the layer that will be clicked - "Add Event" - "Press."
* <mark style="color:red;">Add Condition 1: tap = 0</mark> (indicating the interaction count is 0).
* <mark style="color:red;">Add response event "Assign the value": assign the value "tap+1"</mark> (incrementing the interaction count to 1).
* Add other response events: play the rotation animation 1 of the wheel, play feedback sound effects once, etc.

<div align="left"><figure><img src="/files/Y66IT9HV34oecxFADdsV" alt=""><figcaption></figcaption></figure></div>

* <mark style="color:red;">Add Condition 2: tap = 1</mark> (indicating the interaction count is 1).
* <mark style="color:red;">Add response event "Assign the value": assign the value "tap+1"</mark> (incrementing the interaction count to 2).
* Add other response events：play the rotation animation 2 of the wheel, play feedback sound effects once, etc.
* **Similarly, if you want to handle the player's third click, fourth click, and so on, you can set tap = 2, tap = 3, and so on.**

<div align="left"><figure><img src="/files/OXF6xvKBlmNNrUIxmp4y" alt=""><figcaption></figcaption></figure></div>

*The parameters for the rotation animation of the wheel are as follows*

<div align="left"><figure><img src="/files/WHp1JC47j3x429Gd0b86" alt=""><figcaption></figcaption></figure></div>

With these steps, the event setup is complete. When you encounter a need to **"calculate the interaction count on same layers to trigger specific feedback,"** you can try applying this logic and method in your own projects!

## <mark style="color:blue;">📒Using Global Variables to Control Interaction Toggles</mark>

### <mark style="background-color:orange;">1.Application Scenarios</mark>

**To achieve an effect where player interaction is disabled during feedback playback and only re-enabled afterward**, you can use a Global Variable to control interaction. Here are some examples:

* Example 1: In a match-3 gameplay, after a successful elimination, particle effects and sound feedback are triggered. The player shouldn't be able to click other blocks until the feedback is complete.
* Example 2: When clicking a blind box, an item image pops up. Other blind boxes should not be clickable until the image disappears.
* ... ...

### <mark style="background-color:orange;">2.Case Preview</mark>

Take the [*Match 3 Dress Up*](https://playable-portal.mintegral.com/#/mindwork-view?url=https%3A%2F%2Fmmp-cdn.rayjump.com%2Fmindworks-interactive-ads.html%3Furl%3Dhttps%253A%252F%252Fmmp-cdn.rayjump.com%252Fgm%252Ft%252F20001751%252F13755%252Fpv%252F24%252F12%252F09%252F6756911e0db74%252Fproject.html%253Floading%253D1%2526preview%253Dtrue%2526lang%253Dzh-cn%2526preview%253Dtrue%2526itavideo%253D2%2526vconsole%253D0%2526mw_test%253D0%2526loading%253D1%26mw_test%3D0%26is_browser_tips%3D1%26ptloading%3D1%26track_data%3D%257B%2522pid%2522%253A20001751%252C%2522uid%2522%253A142552%252C%2522skin_id%2522%253A13755%252C%2522sct%2522%253A%2522pt_template_index%2522%252C%2522env%2522%253A%2522p%2522%252C%2522cc%2522%253A%2522SG%2522%257D\&orientation=3\&name=\&language=en,zh-cn) as an example:  During the elimination process, other blocks can't be clicked until particles and sounds finish playing.

### <mark style="background-color:orange;">3.Step-by-Step Explanation</mark>

To implement this, follow two main steps: Add a boolean Global Variable → Add Conditions and Assign the Value in Layer Events

#### <mark style="color:red;">**Step 1:  Add Global Variables**</mark>

* Click on \[Global Variables] - \[Add variables]
* Enter the variable name (e.g., eliminate).
* Select variable type as \[Boolean]
* Set the initial value to false

<div align="left"><figure><img src="/files/lJlNCWiMJ3x3rXEIPKIc" alt=""><figcaption></figcaption></figure></div>

#### <mark style="color:red;">Step 2: Add Conditions and Assign the value</mark>

* Take one of the blocks as an example. Select the corresponding layer, and under all existing click event Conditions, add a new Condition: "eliminate = false".
* Repeat the same setup for all other blocks.

<figure><img src="/files/IHXAHshKxtK7O03s1mjn" alt=""><figcaption></figcaption></figure>

* Then, go to the scene-level events. Under the Conditions that handle feedback playback, set up the following response events:
  * Assign the value "eliminate = true"
  * After a delay of 0.5s (which equals the duration of the feedback), assign the value "eliminate = false"
* Repeat similar operations for other relevant Conditions as needed.

\*To put it simply: <mark style="color:orange;">when "eliminate = false", the click events are active. Once an elimination is triggered and feedback plays, setting "eliminate = true" disables further clicks. After a 0.5s delay, re-assigning "eliminate = false" re-enables the click events.</mark> This way, a Global Variable is used to toggle interaction on and off across the project.

👉 For the full tutorial of this case, please refer to: [\<Match 3 Dress Up>Blank Canvas Tutorial](/playturbo-case-study/playable-content-editor/elimination-and-match-gameplay-cases/less-than-match-3-dress-up-greater-than-blank-canvas-tutorial.md)  [\<Match 3 Dress Up>Blank Canvas Tutorial](/playturbo-case-study/playable-content-editor/elimination-and-match-gameplay-cases/less-than-match-3-dress-up-greater-than-blank-canvas-tutorial.md#lnpxj-1)

<div align="left"><figure><img src="/files/ID8bYN5RYBkaPzrdXN1u" alt=""><figcaption></figcaption></figure></div>

🌟**Case Extension**:  If you're working on the blind box click gameplay mentioned in Example 2, the logic becomes even simpler.

* Similarly, add a Global Variable of Boolean type, such as "click", and set its initial value to false.
* Under all blind box click events, add a Condition: "click = false"
* Then, in the Condition of each click event, simply add: Assign the value "click = true"/ Add a delay of 0.5s / Assign the value "click = false"

That’s all you need to achieve the desired result.

## 📒<mark style="color:blue;">Countdown Timer Setup</mark>

### <mark style="background-color:orange;">1.Application Scenarios</mark>

**The initial screen includes a countdown timer.**&#x20;

* **When the player has no action or fails to achieve a specific goal within the set time, trigger the countdown and proceed to Ending A.**&#x20;
* **When the player successfully interacts or achieves the specific goal within the set time, cancel the countdown and proceed to Ending B.**

### <mark style="background-color:orange;">2.Case Preview</mark>

&#x20;Gameplay Process of [This Case](https://tinyurl.com/8de4wcw2):

* Upon entering the trial, displaying core gameplay and the countdown timer.&#x20;
  * If the player completes the drawing within 10 seconds, redirect to the victory page.&#x20;
  * If the player fails to complete the drawing within 10 seconds, redirect to the product information page.

<div align="left"><figure><img src="/files/AUS4WV2POXoHOx3uTmOj" alt=""><figcaption></figcaption></figure></div>

### <mark style="background-color:orange;">3.Step-by-Step Explanation</mark>

To set up a complete countdown timer, follow these 2 steps: triggering the countdown and canceling the countdown.

#### <mark style="color:red;">Step 1: Trigger the Countdown</mark>

1）After adding the countdown asset, set the countdown sequence as "Playback Interval: 1000ms" and "Automatically Play Once on Entry."

<div align="left"><figure><img src="/files/pEX9U3F4MGvHwdlrvQFo" alt=""><figcaption></figcaption></figure></div>

2）In the core gameplay scene, Add Event - "Timing trigger."

3）Set the execution delay of N seconds to trigger the failure result (e.g., redirect to Scene 3 after 10 seconds).

<div align="left"><figure><img src="/files/BwFs0i8ZCXelkUrgpvci" alt=""><figcaption></figcaption></figure></div>

#### <mark style="color:red;">Step 2: Cancel the Countdown</mark>&#x20;

**In the event for successful interaction, add response event "Cancel execution delay".**&#x20;

Select the timer ID set in the previous step (e.g., after completing the drawing, redirect to Scene 2 and cancel the timer "timer\_1").

<div align="left"><figure><img src="/files/FrjlCZZfVUMh6VbdeLUr" alt=""><figcaption></figcaption></figure></div>

Tip: There are multiple countdown presets available in "Presets Library" for your convenience! [Presets Library](/playable-tools-content-editor/content-editor-user-guide/editing-page-module-intro/top-asset-library/presets-library.md)

<div align="left"><figure><img src="/files/JsvoxR5wRvpFtSc6JImG" alt="" width="398"><figcaption></figcaption></figure></div>

## 📒<mark style="color:blue;">Real-Time Error Feedback Following Dragged Position</mark>

### 1. [Case Preview](https://playable-portal.mintegral.com/common-viewer/mindwork-view.html?url=https%3A%2F%2Fmmp-cdn.rayjump.com%2Fmindworks-interactive-ads.html%3Furl%3Dhttps%253A%252F%252Fmmp-cdn.rayjump.com%252Fps%252Fpreview%252F24%252F09%252F30%252F66fa7376a40e8%252Findex.html%253Floading%253D1%2526preview%253Dtrue%2526lang%253Den%2526preview%253Dtrue%2526itavideo%253D2%2526vconsole%253D0%2526mw_test%253D0%2526loading%253D1%26mw_test%3D0%26is_browser_tips%3D1%26ptloading%3D1%26track_data%3D%257B%2522pid%2522%253A3116454%252C%2522uid%2522%253A8709%252C%2522sct%2522%253A%2522pt_project_ps%2522%252C%2522env%2522%253A%2522p%2522%252C%2522cc%2522%253A%2522CN%2522%257D\&orientation=3\&name=\&language=en)

### 2. Step-by-Step Explanation

* In the Asset Library - Particle, add any particle effect. Only one particle effect is needed.
* In the \[Particle Thumbnail] section, replace the particle image with an error feedback image, such as "×".

<div align="left"><figure><img src="/files/Rc8QWJ8SbbVrP5SryLh6" alt=""><figcaption></figcaption></figure></div>

* Adjust the particle parameters according to the values in the image below.

<div align="left"><figure><img src="/files/eJzxEYKCEEYsxBjcAgbm" alt=""><figcaption></figcaption></figure></div>

* Select multiple layers (particle, draggable image, etc.) to group them together, and then hide the particle layer.

<div align="left"><figure><img src="/files/MpRAw4rVb32Ywk5xYwwh" alt=""><figcaption></figcaption></figure></div>

* Add a Trigger event to the drag group - **Not dragged to target position**, and set the drag area.
* Add response events: Display particle effect. Play the error sound effect once from the start.

<div align="left"><figure><img src="/files/jSN4lajWzOa3ZEOCDTAi" alt=""><figcaption></figcaption></figure></div>
