problem with global variables

Get help using Construct 2

Post » Mon Dec 09, 2013 11:03 am

I already post it, but not receive any response, so i open new thread.
problem with global variables
to see it press first green button
after screen returns back you will see there is no levels buttons,
If i set levels buttons global to "NO" (in properties) they not disappearing. BUT they has to to be set "YES" to be functional.


Please help me make level buttons not disappearing
https://www.dropbox.com/s/tifimk1a18ppe8e/menu_var.capx
Image
B
14
S
6
G
5
Posts: 99
Reputation: 3,825

Post » Mon Dec 09, 2013 11:58 am

Save the state info into an array on first launch and read the states from the array when you load the level. You can easily update the states in the array when you complete a level.

example:

start with an array of size 0,1,1

on start of layout
-if array.height = 0:
-- for each levels_button ordered by levels_button.level descending:
--- if array.height < levels_button.level: set size to levels_button.level,1,1
--- : set at levels_button.level-1: levels_button.state
- for each levels_button ordered by levels_button.level ascending:
-- : levels_button set state to array.at(levels_button.level-1)
set levels_button animation frame to levels_button.state


going to a level:

- save global var currentlvl = levels_button.level; go to level


end of level:

- set array.at(currentlvl-1) = 2; set array.at(currentlvl) = 1
go to level selection



and don't forget to set animation speed of your level buttons to 0mindfaQ2013-12-09 11:59:10
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Tue Dec 10, 2013 4:39 pm

Thanks. I made it at last!Chigabooga2013-12-10 16:39:24
Image
B
14
S
6
G
5
Posts: 99
Reputation: 3,825


Return to How do I....?

Who is online

Users browsing this forum: max2612 and 24 guests