Closed AhoyLemon closed 9 years ago
So, I tried something that I totally thought would work, but it broke the whole end game population, so I rolled back all the JS changes, but kept the css changes. Here's what I tried...
sockets, js, line 356
placeClasses=["first-place","second-place","third-place","fourth-place","fifth-place","sixth-place","seventh-place","eighth-place"];
var p=0;
for(i = 0; i < finalPlayerList.length; i++){
$('#place' + (i+1)).removeClass('hidden');
$('#namePlace' + (i+1)).text(scoresArray[i].name);
$('#scorePlace' + (i+1)).text(scoresArray[i].score);
if (scoresArray[i].score != scoresArray[i-1].score) {
p++;
}
$('#place' + (i+1)).addClass(placeClasses[p]);
}
That looks like what I was thinking of, except you would need to do the first player separately before the loop otherwise this line
if (scoresArray[i].score != scoresArray[i-1].score) {
will cause issues because scoresArray[-1] doesn't exist.
Oh! I figured out my other JS problem too, hang on, I'll get this.
Tiny thing, but a thought.
The color scheme for the game over screen is built on
:nth-child()
syntax. It would be cool if, as it populated the player scores and names, it would also insert a class based on what place that person was in, so in the case of a tie, two players would have the same color. Ex:I think I can figure out a way to do this myself, but the result might be inelegant.