MicrolearnENPTES

Trigger once

Lesson 6 of 16 · GDev.Micro

Some moments should happen once, like a fanfare when the player reaches 5 coins. But Score ≥ 5 stays true on every frame after that, so its actions repeat about 60 times per second.

Add the condition Trigger once while true. The event then runs only on the frame its conditions become true, and waits until they turn false before it can run again.

Preview without it first and watch Sounds played climb in the debugger. Then fix it.

In GDevelop, Trigger once is one of the general conditions. It is the standard fix for sounds, effects and messages that fire too many times.

When Score reaches 5, play the fanfare exactly once.

Do it in the browser: a real game design tool, a short mission and instant feedback. No install.

Start this lesson — free
← Show the scoreTimers and spawning →

All lessons · GDev.Micro