IL NOUS A ATTRAPE
This commit is contained in:
parent
e498f06d7f
commit
a192e16f73
@ -76,7 +76,7 @@ function component(largeur, longueur, color, x, y, type) {
|
|||||||
function startGame() {
|
function startGame() {
|
||||||
personnage = new component(30, 50, "blue", 10, 120);
|
personnage = new component(30, 50, "blue", 10, 120);
|
||||||
personnage.gravity = 0.05;
|
personnage.gravity = 0.05;
|
||||||
score = new component("30px", "Consolas", "black", 280, 40, "text");
|
score = new component("30px", "Consolas", "black", 500, 40, "text");
|
||||||
plateau.start();
|
plateau.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ function updateGameArea() {
|
|||||||
var x, longueur, gap, longueurMin, longueurMax, minGap, maxGap;
|
var x, longueur, gap, longueurMin, longueurMax, minGap, maxGap;
|
||||||
for (i = 0; i < obstacle.length; i += 1) {
|
for (i = 0; i < obstacle.length; i += 1) {
|
||||||
if (personnage.crashWith(obstacle[i])) {
|
if (personnage.crashWith(obstacle[i])) {
|
||||||
|
this.jeuxFini(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,6 +117,15 @@ function everyinterval(n) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function jeuxFini(i) {
|
||||||
|
var messageMort;
|
||||||
|
if (personnage.crashWith(obstacle[i])) {
|
||||||
|
messageMort = new component("30px", "Consolas", "red", 150, 60, "text");
|
||||||
|
messageMort.text = "Il vous à attrapé...";
|
||||||
|
messageMort.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function sauter(n) {
|
function sauter(n) {
|
||||||
personnage.gravity = n;
|
personnage.gravity = n;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user