# How do I Count stars in select level game

0 favourites
• 7 posts
From the Asset Store
A complete set of Graphic, User Interface element to build 2D mobile game or PC game.
• https://www.scirra.com/tutorials/311/level-select

in above link pls anybody tell my how to count stars of each level

• Could you explain what it is you want exactly, before we give answers to a question you didn't ask?

• If you want the total amount of stars, you could either loop through the array and add to a global variable for each spot in the array stars are awarded..

You could ofcourse also add to a global variable based on the animation of each level object..

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• yes i want total amount of stars

i have did, but wrong, when level playing again

suppose i get 2 stars and then i play again this level and gain 3 stars but it counting 5 stars.

m not getting this point how to do this

pls suggest

• I don't know what you did and how, so without knowing that it's pretty hard to tell you what went wrong..

Are you adding to the amount of stars without resetting?

• Ok

suppose I have 10 level

i m getting star on each level as per<B>level select tutorial</B>

i have put

if "stars" are > 0 add "stars" to "count stars"

• one thing more i have try in this

set "count stars" to max(stars, levels.At(currentLevel)) - min(stars, levels.At(currentLevel))

by doing this

suppose we play two time first we get 1 star and second time we get 3 star

when we get 1 star, 1 is added to "count stars"

when we get 3 star, then

max is 3 and min is 1 = 2 added to "count stars"

now updated "count stars" is 3

but problem comes when we play 3 times and we gets 1,2,3 stars

.

1st time we get 1 star

.

2nd time we get 2 star

2-1= 1 more added to "count stars"

3rd time we get 3 star

3-1=2 adding to "count stars" this is the problem

because when we play 3rd time i want to deduct 2stars

.

but 2 is not "max" neither "min"

i don't know how to fix it

or may be their is any other solution available

or i m going wrong way

• 7 posts