NDI-2019/Jeux_404/scores.js
2019-12-06 01:43:54 +01:00

44 lines
1.2 KiB
JavaScript

//VARIABLES
var premier = 0;
var deuxieme = 0;
var troisième = 0;
var ligne;
var score = new Array("1ST", "2ND", "3RD");
var premier = score["1ST"];
var deuxieme = score["2ND"];
var troisième = score["3RD"];
var tableau = {
canvas: document.createElement("canvas"),
start: function() {
this.canvas.width = 200;
this.canvas.height = 150;
this.context = this.canvas.getContext("2d");
this.canvas.style = "position:absolute; margin-write: +500px; border: 2px solid #0d0d0d;";
document.body.insertBefore(this.canvas, document.body.childNodes[0]);
this.interval = setInterval(updateGameArea, 20);
},
clear: function() {
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
}
}
//METHODES
function update(score) {
if (score > premier)
this.premier = score;
else if (score > deuxieme)
this.deuxieme = score;
else if (score > troisième)
this.troisième = score;
}
function load() {
update();
for (var i = 0; i < score.lenght; i++)
document.write("j'écris");
//document.write(score[i] + score[score[i]] + '<br />');
tableau.start();
}