If condition and then action

This is kind of a feature request but how do I make there be if and then events because I have a toggle for all scenes and is put to checked. How do I make it if it’s unchecked by a player in one scene then it’s unchecked in the other scenes or vice-versa

Make the toggle a global object and a global variable.

What does the toggle do. Is it just a decoration or does it serve a purpose.

The toggle is to turn on/off the music, i’m adding another toggle to turn sound on/off. (I have played different music and muted game music for the video) Watch video to see the issue

Edit: The video link didn’t work so I changed it

Show me an example of it being a global variable

Ok I’ll have to watch the video and show an example when I get home.

But for instance I have a sound button and music button. I didn’t make them global objects because you can only access them in the menu scene. So when you press them they set global bool MusicOff or global bool SoundOff to true. If those are true it sets their animation to greyed out. If set to true and music or sound is playing on channel whatever it stops playing it (in the menu scene). In all othere scenes I just put music and sound events under a main condition of if global bool SoundOff is false, play these sounds on these channels. If global bool MusicOff is false, play this music on this channel. You can do this as an external event, I didn’t because each scene plays different sounds. If you access the toggles in any scene you can probably do an external event telling it to set the toggle animation to off if your glabal variable is a certain value. If you’re using an extension like I was (panel button extension) youight have to finesse it a little.

Just to let you know, the music toggle and sound toggle are toggle switches not buttons. But i’m pretty sure it will work the same way. Show me what the events should be like and everything I need to know. So show me screenshots of the global bools, all the events needed to do this, and the different scenes.

There are 4 levels and one menu screen. If you need me to give you more details of the game or anything let me know.

If you haven’t seen video already, I have changed the video link.

Ok I’ll look when I get off work.

Also, give these examples with the toggle switches in every scene with the global variable. I have the panel button extension, but i’m using toggle switches so there’s no need for that in this situation.

Hey, just wanted to see if you can show examples.

Yep buddy I’m on it now. I’m going to watch your video first.

Ok, hopefully it works.

What??? Everything I do always works. Eventually.

https://drive.google.com/file/d/1ESjUEBDojIPDO0y-YRkRP-CuqmiJn3RR/view?usp=sharing

@Luminity

I don’t know if it’s good examples I am on Chromebook so I can’t see the json file.

@Lucky-j

Please do not make demands of other community members. Lucky-j provided you with an example game. It is literally the best kind of example.

1 Like

I am not demanding! I just know looked at the json file and it looks ok except I need it as an example in GDevelop if it’s not to much to ask.

@Lucky-j
@Silver-Streak

You do not look at the json files. You would extract the zip and open the game.json in gdevelop as with any other gdevelop project. They are an example game.

Being on a Chromebook does not matter. If you are using the web IDE and have a google drive you can extract the zip to a folder there and load the project.

Ok thank :slight_smile: I am going to try it

Oh sorry, I’ll put the event shots up too just in case, but I think they’ll make more sense if you can open it up and poke around and play it.

Here buddy I updated the Toggle Logic external event (image) to get rid of that annoying flicker when changing scenes when the bool was set to true.

Updated file

https://drive.google.com/file/d/1NO2a0tLUYLFGlWhref_BxLoSgGFzvR9u/view?usp=sharing

I went on my mac and opened it. Thanks for the picture examples as well since I switched back to my Chromebook. :smiley: