How do I compare instances of a variable

Get help using Construct 2

Post » Thu Sep 17, 2015 2:32 am

more specifically if there are 10 players and I want the 3 with the top highest score to get a bonus/prize. How could I pick those 3 or at least sort the player objects by which have the highest score?
Last edited by bbjGames on Thu Sep 17, 2015 6:49 pm, edited 1 time in total.
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Thu Sep 17, 2015 5:04 am

create 3 Compare variable > greater or equal value -> action
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Thu Sep 17, 2015 6:56 pm

I know but the score can vary is the issue. Like If I say greater than 10 and 5 of the players get a score higher than 10 then 5 players would get a prize instead of 2 or if no players get a score higher than 10 nobody gets a prize. I want the top 3 players to get a prize each time.
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Fri Sep 18, 2015 8:48 pm

Ok I found out how :)
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Fri Sep 18, 2015 9:21 pm

I'm using the pick highest option for sprites but now I have the issue of if two players tie with a highscore
B
22
S
8
Posts: 203
Reputation: 2,059

Post » Fri Sep 18, 2015 9:42 pm

It would be easier for you to use just one array to keep all player scores at same time, update it and sort whenever a player get some points. Then at the end of the game you already have first 3 places.

If two or more player tie you need to make 2 checks

player 1 = player 2 - tie, do something
else
player 2 = player 3 - tie, do something else
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 9 guests