Problem with global variables?!

Get help using Construct 2

Post » Fri May 23, 2014 8:16 am

Hi everyone,

So I'm having a frustrating time making a working 'mute music' button.

At the moment the user presses a button and a global variable gets changed, which then mutes the music on the start-up of other layouts.

Unfortunately because I am also loading the game on other layouts, the load over-writes the global variable for the muted music and hey presto, the music is back playing.

a) Am I using the load feature wrong?
b) Can I exclude the mute music global variable from being overwritten on load?
c) Anyone got any other suggestions?

Thanks in advance
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Fri May 23, 2014 12:33 pm

You can save the global variable via the WebStorage component and reload it when you reload the game ;)
Image Image Image
B
82
S
21
G
8
Posts: 163
Reputation: 11,516

Post » Sat May 24, 2014 1:04 pm

roberto wrote:You can save the global variable via the WebStorage component and reload it when you reload the game ;)


Hi Roberto,

Can I still use web storage even though my game will be deployed to mobiles?

I just made a quick test and it works perfectly in the browser but not on the mobile device.

Thanks!
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Sat May 24, 2014 3:33 pm

It should work on mobile as well: I never had any issue with saving data, like scores for example, on a mobile device by using the webstorage component...
Image Image Image
B
82
S
21
G
8
Posts: 163
Reputation: 11,516


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 62 guests