How do I detect the game opening

Get help using Construct 2

Post » Sun Apr 06, 2014 10:26 pm

Hello

I want to add 1 on a value on my webstorage everytime the player enters on the game. My first thought was "on start of layout" but it doesn't work properly, because it will add 1 when you change layout and come back to the first layout (the menu layout). And I want just add 1 when you open the game, not in layout changing

Any ideas?

Thanks and regards.
B
21
S
3
Posts: 77
Reputation: 1,112

Post » Sun Apr 06, 2014 10:39 pm

Maybe put the on start of layout command in a group and then have that group be disabled after the first time it is started?
B
8
S
1
Posts: 76
Reputation: 949

Post » Sun Apr 06, 2014 10:51 pm

In that case, the simpler method I think would be:

-have a global variable named game_started, value 0
-on start of the layout, and if game_started is 0, set the webstorage value and also set game_started to 1

then you never change the value of game_started and you'll be fine
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Wed Apr 09, 2014 2:23 pm

Thanks for your answer, finish I can do this.
B
21
S
3
Posts: 77
Reputation: 1,112


Return to How do I....?

Who is online

Users browsing this forum: blue visionary and 31 guests