[Solved] How do I make a Slider Bar to control sound?

Get help using Construct 2

Post » Fri Jun 19, 2015 8:10 am

Image
@deathangel1479, I've set it to later, but continues don't working.
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Post » Fri Jun 19, 2015 8:44 am

The get value need to int... Seem Storage give always a string.
I also added the correct math for percent.

volume2
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
10
S
4
G
1
Posts: 158
Reputation: 1,303

Post » Fri Jun 19, 2015 9:04 am

@deathangel1479, have a bug here. When i click in the "sound" icon (what make it mute), close and reopen the preview window, the value is the last than my action of clicking in button.
Last edited by DaniellMesquito on Fri Jun 19, 2015 9:14 am, edited 1 time in total.
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Post » Fri Jun 19, 2015 9:05 am

Here I'm using NW.js to test, and when the project loads, have a flash of 100%, and after, the saved value. Why is occurring this delay? :(
Last edited by DaniellMesquito on Fri Jun 19, 2015 7:39 pm, edited 1 time in total.
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Post » Fri Jun 19, 2015 9:30 am

First problem solved, I edit it.

Second problem is a little tricky.
Thats because the value is set a few ms after the layer is shown.
Solutions:
1. You can solve this if you show/create the Objects first if the values are loaded.
2. You can hide it with for example a fader.
3. You can solve it with another layer before this one and load the Storage there and then go to the second layer(current).

But its only a example...
You also can add another var to set it after unmute to last value, and much other....
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
10
S
4
G
1
Posts: 158
Reputation: 1,303

Post » Fri Jun 19, 2015 7:50 pm

I prefer the first option for solve the delay. My problems with this .capx are solved, thanks! :D
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Post » Fri Jun 19, 2015 10:10 pm

@deathangel1479 I've fixed up the delay, changed "Set volume" to "Set master volume", and after set mute off, return to anterior value. Too, now I programmed for the sound plays only when using the Slider Bar (but don't work because Construct 2's HTML elements is on top of layer constantly and don't support touch events as sprites do well).

Here is the updated .capx.
Isn't perfect because the Slider Bar/Percentage are not sensible (have jump between numbers), but is very better now.

You can write a tutorial in your default germany language using this .capx, and I'll translate to english. :D

Note: I've used the deprecated "Web Storage" plugin to figure the "before_volume", because is very complicated for me to get "Local Storage"'s values. Used a global value because Slider Bar don't accept strings, only numbers...
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Previous

Return to How do I....?

Who is online

Users browsing this forum: MoscowModder and 10 guests