How do i create an image where each click of the left mouse button toggles the sound on and off . Thank guys.
With some events:
Conditions: Mouse left click is pressed
Cursor is over ToggleSoundSprite
Trigger once
Actions: Do = 1 to variable else//Sub-event 1 Conditions: Variable sound_enable is = 0 (or ToggleSoundSprite animation is = 0) Actions: Do = 1 to variable sound_enable (or set ToggleSoundSprite animation = 1) Enable sound Do = 0 the variable else //Sub-event 2 Conditions: Variable sound_enable is = 1 (or ToggleSoundSprite animation is = 1) Variable else is = 1 Actions: Do = 0 to variable sound_enable (or set ToggleSoundSprite animation = 0) Disable sound
With these events you can use a variable to track the sound (sound_enable) or the animation of the sprite object (button) that toggles the sound (animation 0 = sound disable, animation 1 = sound enable).
The โelseโ variable is a workaround to avoid launching the second sub-event just after the first one, in other words, allows to run only one of the sub-events each time
3 Likes
This work great.
Thanks Lizard-13