diff --git a/Jeux_404/gifs/homme trop swag.gif b/Jeux_404/gifs/homme trop swag.gif new file mode 100644 index 0000000..4150586 Binary files /dev/null and b/Jeux_404/gifs/homme trop swag.gif differ diff --git a/Jeux_404/main.html b/Jeux_404/main.html index 6005a28..d9eacf2 100644 --- a/Jeux_404/main.html +++ b/Jeux_404/main.html @@ -9,8 +9,7 @@ - +

Fuyez l'homme en noir !

- - + + + + + homme en noir
+ + \ No newline at end of file diff --git a/Jeux_404/scores.js b/Jeux_404/scores.js new file mode 100644 index 0000000..f1adb72 --- /dev/null +++ b/Jeux_404/scores.js @@ -0,0 +1,43 @@ +//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++) + tableau.start(); +} \ No newline at end of file diff --git a/Jeux_404/script.js b/Jeux_404/script.js index dcce74c..7355f15 100644 --- a/Jeux_404/script.js +++ b/Jeux_404/script.js @@ -6,10 +6,10 @@ var score; var plateau = { canvas: document.createElement("canvas"), start: function() { - this.canvas.width = 480; - this.canvas.height = 270; + this.canvas.width = 700; + this.canvas.height = 280; this.context = this.canvas.getContext("2d"); - this.canvas.style = "position:absolute; left: 50%; margin-left: -250px; bottom: 50%; margin-bottom: +50px"; + this.canvas.style = "position:absolute; left: 50%; margin-left: -250px; bottom: 50%; margin-top: +50px"; document.body.insertBefore(this.canvas, document.body.childNodes[0]); this.frameNo = 0; this.interval = setInterval(updateGameArea, 20); @@ -83,7 +83,7 @@ function startGame() { function updateGameArea() { - var x, taille, gap, tailleMin, tailleMax, minGap, maxGap; + var x, longueur, gap, longueurMin, longueurMax, minGap, maxGap; for (i = 0; i < obstacle.length; i += 1) { if (personnage.crashWith(obstacle[i])) { return; @@ -93,14 +93,13 @@ function updateGameArea() { plateau.frameNo += 1; if (plateau.frameNo == 1 || everyinterval(150)) { x = plateau.canvas.width; - tailleMin = 20; - tailleMax = 200; - taille = Math.floor(Math.random() * (tailleMax - tailleMin + 1) + tailleMin); + longueurMin = 20; + longueurMax = 200; + longueur = Math.floor(Math.random() * (longueurMax - longueurMin + 1) + longueurMin); minGap = 50; maxGap = 200; gap = Math.floor(Math.random() * (maxGap - minGap + 1) + minGap); - obstacle.push(new component(10, taille, "green", x, 0)); - obstacle.push(new component(10, x - taille - gap, "green", x, taille + gap)); + obstacle.push(new component(10, x - longueur - gap, "grey", x, longueur + gap)); } for (i = 0; i < obstacle.length; i += 1) { obstacle[i].x += -1;