Volume/Mute Button keeps switching animation to default

Jovial Games

  • Posts: 132
Hey guys, I made a mute/volume button for my game. Its in the updating function, so what happens is that even though the button works, it keeps switching back to the default stage which was the unmute animation.

I've attached a picture of the code, how can I properly implement the button in a way that if its muted, the muted animation remains?

Thanks!


JeffreyDriver

  • Posts: 2262
Rather than have it all in an updating event, use a custom event.

When mouse is released on self trigger SOUNDTOGGLE in this behaviour

Put your code in the SOUNDTOGGLE event.

Jovial Games

  • Posts: 132
Hi,

I do the following:

I created an on click event : When mouse was released on self
trigger event SOUNDTOGGLE

Custom Event-  When SOUNDTOGGLE happens
Do the following as in the picture.

But the problem persists, the animation changes to the correct one and when I change the scene and come back to the scene where I had the volume button, the animation switches back to the default one.

All I want is for the animation to not change once I change the scene. For example the volume button is on the menu and I click it to mute the music, now it shows a muted icon, I switch to level selection scene and come back to menu, the muted icon changes back to the unmuted icon which is the default animation

Luyren

  • *
  • Posts: 2421
http://www.stencyl.com/help/view/game-attributes/
Read this, it has the information you need.

The volume information should be stored in a game attribute, and you simply change the animation when created based on that game attribute.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Jovial Games

  • Posts: 132
I tried with game attribute but it still didn't work

Luyren

  • *
  • Posts: 2421
Saying "it didn't work" doesn't tell us anything. Post a screenshot of your code.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter