Ranking board with photos.

I’m developing a racing game. The best 10 times are ranked using PlayerPrefsX. I would like to implement 2 things:

  • If the player get a good time, the webcam will take shot of him.
  • This picture will be next of the player’s time. (I will use little plane meshs)

My doubt is, how link the photo with the time, for example if a player has the third best time and the other player got the first time, how to make the his photo change the third place/slot to the forth?

Tks for all.

Use a list of textures to display the player’s time. In the case you gave, the other player screenshot is pushed at the beginning of the list, and the player’s one is now forth.

And for the screenshot itself.

Thanks Berenger. Could example a similar script. I didn’t get the idea how to make the photo changing by one slot to another, comparing the times.

Here is my code, making the Ranking by time

enter code here
var resetScores : boolean = false;

var scores : float;

var scoreTexts : String;

function Start() {

if(resetScores)
ResetScores();

scores = PlayerPrefsX.GetFloatArray(“Scores”);

if (PlayerPrefs.GetFloat(“score”)!=0){
for (i = 0; i <scores.Length; i++){
if(PlayerPrefs.GetFloat(“score”) < scores*){*
scores = PlayerPrefs.GetFloat(“score”);
PlayerPrefsX.SetFloatArray(“Scores”, scores);
break;
}
}
}
for(i =0; i<scores.Length; i++){
guiTime = scores*;*
var minutes : int = guiTime / 60;
var seconds : int = guiTime % 60;
var fraction : int = (guiTime * 100) % 100;
scoreTexts = String.Format (“{0:00}:{1:00}.{2:000}”, minutes, seconds, fraction);
}
}
function OnGUI() {
GUI.Label(Rect(200,50,60,30), scoreTexts[0]);
GUI.Label(Rect(200,150,60,30), scoreTexts[1]);
GUI.Label(Rect(200,250,60,30), scoreTexts[2]);
GUI.Label(Rect(200,350,60,30), scoreTexts[3]);
GUI.Label(Rect(200,450,60,30), scoreTexts[4]);
GUI.Label(Rect(800,50,60,30), scoreTexts[5]);
GUI.Label(Rect(800,150,60,30), scoreTexts[6]);
GUI.Label(Rect(800,250,60,30), scoreTexts[7]);
GUI.Label(Rect(800,350,60,30), scoreTexts[8]);
GUI.Label(Rect(800,450,60,30), scoreTexts[9]);
}
function ResetScores() {
PlayerPrefsX.SetFloatArray(“Scores”, scores);
}