From 01a5e11b69fb2807478fe2173a0c4e20b4683e34 Mon Sep 17 00:00:00 2001 From: Chiara Date: Fri, 6 Dec 2019 01:43:54 +0100 Subject: [PATCH 1/2] sauvegarde avant scores --- Jeux_404/gifs/homme trop swag.gif | Bin 0 -> 146 bytes Jeux_404/main.html | 28 +++++++++++++++---- Jeux_404/scores.js | 44 ++++++++++++++++++++++++++++++ Jeux_404/script.js | 17 ++++++------ 4 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 Jeux_404/gifs/homme trop swag.gif create mode 100644 Jeux_404/scores.js diff --git a/Jeux_404/gifs/homme trop swag.gif b/Jeux_404/gifs/homme trop swag.gif new file mode 100644 index 0000000000000000000000000000000000000000..415058660a7219abb5cb20636b32d9b05a3a76d0 GIT binary patch literal 146 zcmZ?wbhEHb6krfw_`m=Jj6kgTpWDwhB-q(8z|~04fEg_GlZ8_bD5V2Z15(VuB-bKX zczVXIs4l@Ev-hWNefXF8FtxO!a*D#Mjq28VtPF~nT9lEsR91aHS3Bu)rE1f(39gYj PTlW}F>njdsV6X-NNyIAI literal 0 HcmV?d00001 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..c4e04e1 --- /dev/null +++ b/Jeux_404/scores.js @@ -0,0 +1,44 @@ +//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]] + '
'); + 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; From 660b4990441b5682405ccbb3635b2df4df577bf3 Mon Sep 17 00:00:00 2001 From: Chiara Date: Fri, 6 Dec 2019 01:53:01 +0100 Subject: [PATCH 2/2] BUUUUG DE MERDE --- Jeux_404/scores.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Jeux_404/scores.js b/Jeux_404/scores.js index c4e04e1..f1adb72 100644 --- a/Jeux_404/scores.js +++ b/Jeux_404/scores.js @@ -25,6 +25,7 @@ var tableau = { } } + //METHODES function update(score) { if (score > premier) @@ -37,8 +38,6 @@ function update(score) { function load() { update(); - for (var i = 0; i < score.lenght; i++) - document.write("j'écris"); - //document.write(score[i] + score[score[i]] + '
'); + //for (var i = 0; i < score.lenght; i++) tableau.start(); } \ No newline at end of file