How do I Count stars in select level game

Get help using Construct 2

Post » Thu Oct 15, 2015 11:48 am

https://www.scirra.com/tutorials/311/level-select
in above link pls anybody tell my how to count stars of each level
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528

Post » Thu Oct 15, 2015 12:02 pm

Could you explain what it is you want exactly, before we give answers to a question you didn't ask?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 15, 2015 12:05 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 15, 2015 12:13 pm

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
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528

Post » Thu Oct 15, 2015 12:19 pm

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Oct 16, 2015 5:13 am

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"
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528

Post » Fri Oct 16, 2015 9:13 am

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
1 added "count stars"
.
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
Image
B
63
S
39
G
42
Posts: 630
Reputation: 30,528


Return to How do I....?

Who is online

Users browsing this forum: stevenode and 11 guests