-
Classifica gioco
Salve ho un gioco in flash nel mio sito. al termine della partita il punteggio degli utenti viene registrato in una classifica. ma la classifica non č uguale per tutti gli utenti cioč ogni utente ha la classifica dei punteggi realizzati nel suo computer.
Vorrei fare una classifica comune.
Penso ci sia bisogno di un database, io ho quello classe uno di AV solo che tra la gestione files non lo trovo.
come fare aiutatemi grazie.
-
come li salvi i punteggi? con cookie?
-
Inoltre, il database non lo trovi in gestione files, ma devi passare da phpmyadmin (dalla pagina dei tools)
-
Ti incollo il codice
Codice:
stop();
showScores = function () { var i = 10; while (i > 0){ var n = game_so.data.highScores_array[((page + i) - 1)].name; var s = game_so.data.highScores_array[((page + i) - 1)].score.toString(); var l_mc = this[(("line" + i) + "_mc")]; l_mc.rank_txt.text = (page + i) + "."; l_mc.name_txt.text = n.length ? n.toUpperCase() : "-"; l_mc.score_txt.text = s.length ? s.addCommas() : "-"; l_mc._visible = true; i--; } };
sortScore = function (a, b) { if (a.score < b.score){ return 1; } if (a.score > b.score){ return -1; } else { return 0; } };
page = 0;
maxScore = 100;
if (game_so.data.highScores_array == undefined) {
game_so.data.highScores_array = new Array();
}
if (score > 0 && game_so.data.playerName.length > 0) {
game_so.data.highScores_array.push({score:score, name:game_so.data.playerName});
game_so.data.highScores_array.sort(sortScore);
game_so.data.highScores_array.splice(maxScore);
}
score = 0;
showScores();
last_btn._visible = false;
last_btn.onPress = function() {
page -= 10;
if (page < 0) {
page = 0;
}
if (page < 10) {
last_btn._visible = false;
}
next_btn._visible = true;
showScores();
};
next_btn.onPress = function() {
page += 10;
if (page > maxScore) {
page = maxScore;
}
if (page > (maxScore - 20)) {
next_btn._visible = false;
}
last_btn._visible = true;
showScores();
};
newGame_btn.onRelease = function() {
gotoAndStop(2);
};
ufo_mc.dir = 1;
ufo_mc.onEnterFrame = function() {
if (!this._visible) {
this.dir = int(rnd() * 2) * 2 - 1;
this._x = 250 - this.dir * 300;
this._visible = true;
}
this._x += this.dir * 3;
if (this._x > 550 || this._x < -50) {
this._visible = false;
}
};
stop();
loadVariablesNum ("", 0, "POST");