on restart level - restart 1 glob.variable

Get help using Construct 2

Post » Tue Nov 12, 2013 9:51 am

Hello,
I will explain my situation on the following example:

When I click on for example "Level 2" button I want to set my textObject to 300 and when I click on "Level 15" button the textObject has to be set to 150 for example. Its quite easy, no problem - BUT what if I create the RESTART button?
When I click it I want those textsObjects to be set to its default values.

So when clicked on restart in the level 2 text has to be 300 again (because during the level it will be falling to 0)

How to do this? How to restart a specific global variable in a specific level?trance2013-11-12 09:52:01
B
14
S
4
Posts: 110
Reputation: 1,538

Post » Tue Nov 12, 2013 10:47 am

on restart button click -> write current value in anouther Global Variable


on layout 1 start -> read from the global variable and set the textobjects to this..


idk what you mean maybe explain a bit more :O
B
27
S
7
G
3
Posts: 300
Reputation: 4,573

Post » Tue Nov 12, 2013 11:06 am

I think the easiest way to realize that is to make a function with one param. The Param should be your level.

--> pick textbox // at first pick the textObject
---> param0 equals 2 -> set textbox-text to 300
---> param0 equals 15 -> set textbox-text to 150
B
7
S
3
Posts: 15
Reputation: 1,455

Post » Tue Nov 12, 2013 12:03 pm

I think you can make it using the "on start of layout" and setting the value to the corrrent value for that layout.
If you reset the game on that layout the value will reset to the value specified in the "on start of layout".

GL
B
15
S
1
G
1
Posts: 15
Reputation: 1,051

Post » Tue Nov 12, 2013 12:27 pm

got it, thanks guys...
B
14
S
4
Posts: 110
Reputation: 1,538


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests