Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 189 bytes modified

beta.r3js.org
-=yb4f310 2018-03-24 15:31:25 +01:00
parent 7429de0943
commit d510bc9cee
1 changed files with 29 additions and 20 deletions

View File

@ -250,7 +250,7 @@ GameLib.CustomCode.prototype.waitReload = function(delta) {
this.state.exploding = false;
if (this.state.lives <= 0) {
this.restore();
this.restore();
this.gameOver(false);
return;
}
@ -832,11 +832,20 @@ GameLib.CustomCode.prototype.createFood = function(delta) {
GameLib.CustomCode.prototype.gameOver = function(won) {
this.state.gameOver = true;
this.state.message = {
text : "GAME OVER",
x : 127,
y : 256
};
if (won) {
this.state.message = {
text: "YOU WON!",
x: 127,
y: 256
};
} else {
this.state.message = {
text: "GAME OVER",
x: 127,
y: 256
};
}
this.displayHUD();
}.bind(this)
@ -1160,16 +1169,16 @@ GameLib.CustomCode.prototype.extend = function(gameObject, position, orientation
this.gameOver(true);
}
this.extendSpeedGrain = (GameLib.CustomCode.SPEED_INITIAL - GameLib.CustomCode.MAX_SPEED) / ((GameLib.CustomCode.GRID_WIDTH * GameLib.CustomCode.GRID_HEIGHT) - this.snake.length)
this.speed -= this.extendSpeedGrain;
if (this.speed < GameLib.CustomCode.MAX_SPEED) {
this.speed = GameLib.CustomCode.MAX_SPEED;
}
console.log('speed = ' + this.speed);
this.extendSpeedGrain = (GameLib.CustomCode.SPEED_INITIAL - GameLib.CustomCode.MAX_SPEED) / ((GameLib.CustomCode.GRID_WIDTH * GameLib.CustomCode.GRID_HEIGHT) - this.snake.length)
this.speed -= this.extendSpeedGrain;
if (this.speed < GameLib.CustomCode.MAX_SPEED) {
this.speed = GameLib.CustomCode.MAX_SPEED;
}
console.log('speed = ' + this.speed);
}.bind(this);
/**
@ -1224,10 +1233,10 @@ GameLib.CustomCode.prototype.powerup = function(gameObject) {
}
console.log('speed = ' + this.speed);
console.log('animation speed = ' + this.animation.translationSpeed);
console.log('speed = ' + this.speed);
console.log('animation speed = ' + this.animation.translationSpeed);
this.powerups.splice(
this.powerups.indexOf(gameObject),
1