How do I set properly this audio slider?

Get help using Construct 2

Post » Fri Jun 06, 2014 6:05 am

I'm using a custom audio slider to control all my project sounds, but it have a little issue...
This project have 2 layouts: menu and gameplay. When I set a value on the slider (menu layout) and go to gameplay, everything is fine. But when I lose and back to menu, the slider is reseted...
How can I fix that? please, take a look on the capx.
https://db.tt/zTFS77hG

Ah and, if possible, can you adapt the slider to touch? I tried but with no good results..
THANKS.
B
20
S
4
Posts: 387
Reputation: 2,274

Post » Fri Jun 06, 2014 6:34 am

You calculate the audio value based on the barcontrol, but you need to do the opposite when you start the layout. In 'On start of layout' you need to calculate the barcontrol position based on the current audio setting. Right now it always reverts to the layout, which is always to the right, which then recalculates audio to be 100.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Fri Jun 06, 2014 9:51 am

hi,
use the "Array" to store volume value.
2D Game GUI Designer
B
12
S
4
G
3
Posts: 130
Reputation: 3,778

Post » Fri Jun 06, 2014 9:09 pm

Hey, I tried both metods but with no results... sorry, I'm a noob. :/
can someone explain me clearer or fix that in the capx, please?
And thanks for the answers :)

oh... and the touch thing I've already done.
B
20
S
4
Posts: 387
Reputation: 2,274

Post » Sat Jun 07, 2014 12:11 am

barcontrol.X = bar.Width*(audio/100) + bar.X
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Sat Jun 07, 2014 2:29 am

blackhornet wrote:barcontrol.X = bar.Width*(audio/100) + bar.X

Thank you very much!
B
20
S
4
Posts: 387
Reputation: 2,274


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 11 guests