# Count stars

Get help using Construct 2

### » Sun Mar 16, 2014 12:19 pm

Hi I have a game where each level can be obtained maximum 3 stars, I have a select level 15 missions.

I have a meter to tell how many stars have earned at all levels. For example 5/45 stars.
I have a global variable: stars
As I can do this?
B
13
S
2
Posts: 297
Reputation: 1,717

### » Sun Mar 16, 2014 1:46 pm

@statham - I don't know exactly what you are asking, but keeping global variable for total "stars" is fine. If you want to keep info of how many stars for each level, then you should probably use an array for simplicity.
B
33
S
7
G
8
Posts: 312
Reputation: 8,530

### » Sun Mar 16, 2014 2:41 pm

I want to do the last thing you said, but it's complicated?
B
13
S
2
Posts: 297
Reputation: 1,717

### » Sun Mar 16, 2014 2:57 pm

No it is easy. You need a 1D array. Each value represents the stars earned in the level.

X axis of the array ->

2, 1, 3, 2, 0, 3, 2, 3, ..

https://www.scirra.com/tutorials/307/ar ... ers/page-1
B
10
S
2
Posts: 135
Reputation: 1,090

### » Sun Mar 16, 2014 4:25 pm

If you want simplicity,use global variables
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

### » Sun Mar 16, 2014 5:12 pm

how it works with global variable? example pls
B
13
S
2
Posts: 297
Reputation: 1,717

### » Sun Mar 16, 2014 6:36 pm

@Doc Ai @statham - if you only have a few levels, then you can just use a few global variables (like level1_stars, level2_stars, etc). So, you mentioned 15 levels total in the above post, so maybe that is okay. But for future games with more levels, I would recommend using arrays.
B
33
S
7
G
8
Posts: 312
Reputation: 8,530

### » Mon Mar 17, 2014 8:41 am

Yeah.Time to learn arrays.
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

### » Mon Mar 17, 2014 8:54 am

https://www.scirra.com/tutorials/311/level-select if this is what you want?

Level Select with Star system
Stoorn Memory Puzzle
B
9
S
3
G
1
Posts: 66
Reputation: 1,488

### » Mon Mar 17, 2014 9:40 am

Phuzz wrote:https://www.scirra.com/tutorials/311/level-select if this is what you want?

Level Select with Star system

The level select I have it, what I want is that the level select screen, put the total number of stars that each world. For example I have 5 stars / 45 total stars collected.

I was told to use global variable but not join it with set text... some example code
B
13
S
2
Posts: 297
Reputation: 1,717

Next