GDevelop
GDevelop copied to clipboard
Use buffer variable when starting/stopping particle emission
To be able to use Repeat X Seconds to start and stop emission.

Otherwise, you start and stop the emission on a single frame
While this works, it can also have another unintended side effect, because a start of emission is not immediately considered in the events:
Condition : Variable RestartEmission is true
Action: Start emission of Particles
Condition: Particles does not emit anylonger
Action: Destroy Particles
Will destroy particles, even if you just restarted the emission -> not great.
What you encountered is a more complex problem I think, which is the fact that there is no easy way to express a "else" in GDevelop events. We could consider adding an event containing "Actions" and "Else Actions", but it's a bit more complex than just doing a "if/else" in programming, because we're dealing with list of objects in the events. See this topic where I try to explain two problems: https://forum.gdevelop-app.com/t/if-else-event-we-have-a-solution/21168/10?u=4ian
The solution could be to actually create two new different event kinds: a "logical if/else (actions to be run if the conditions are false)" and a "object if/else (actions to be run on the objects not fulfilling the conditions)" - but I think we need to very carefully design something so that it's obvious how this/these thing(s) would work.
I knew there was something off with this PR. Do you think this "else" condition should be looked into seriously?
I think it should at some point yes, it's a common pain point/misunderstanding. But our answer to this should be carefully designed to not add something more complex than the current solution (which is: there is no else).
If we solve this and add support for "asynchronous actions/conditions" (think of actions like "Wait X seconds before continuing"), I think we have an events sheets system solving most of the demand of users.