How to make if-else situation?

Here, normally both event block will execute one after another. But how can I make gdevelop skip the second block if the first block is true.
Simply, I want to execute only one block at a time here. Just like the if-else condition.

ex:
is_particles = 1 ? is_particles = 0 : is_particles = 1;

2 Likes

@Bouh
@Gruk
Presently i have no idea on how to do that.

1 Like

The way to do it is to set a variable to 0 before the both blocks and make a condition in the second Bloc that checks if the variable is still 0 and set the variable to 1 in the actions of the first block.

1 Like

In a binary situation like this, you can do:
Do = 1 - is_particles to is_particles

1 Like

@arthuro555 is this what you mean? (working as expected though)

you don’t need to create a subevent if there is no action, but yes. And also, don’t use global variables but scenews variables for things like this.

1 Like

If you are Experienced with JavaScript you could add a Javascript event by pressing the plus button and JavaScript event. This might help you.

1 Like

But I don’t understand how can I use JavaScript here in Gdevelop well.
It would very helpful if I could see the JavaScript behind event blocks. (I’ve checked javascript examples though)

It’s easier to understand and work with sub events.
And I’m using global variables because I want to affect all over the game not just in one scene.
Like if particles are off that should affect all the scenes in the game.

Oh, ok, I thougt it was a particle on the scene sorry

1 Like