Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 189 bytes modified
parent
7429de0943
commit
d510bc9cee
|
@ -250,7 +250,7 @@ GameLib.CustomCode.prototype.waitReload = function(delta) {
|
||||||
this.state.exploding = false;
|
this.state.exploding = false;
|
||||||
|
|
||||||
if (this.state.lives <= 0) {
|
if (this.state.lives <= 0) {
|
||||||
this.restore();
|
this.restore();
|
||||||
this.gameOver(false);
|
this.gameOver(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -832,11 +832,20 @@ GameLib.CustomCode.prototype.createFood = function(delta) {
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.gameOver = function(won) {
|
GameLib.CustomCode.prototype.gameOver = function(won) {
|
||||||
this.state.gameOver = true;
|
this.state.gameOver = true;
|
||||||
this.state.message = {
|
|
||||||
text : "GAME OVER",
|
if (won) {
|
||||||
x : 127,
|
this.state.message = {
|
||||||
y : 256
|
text: "YOU WON!",
|
||||||
};
|
x: 127,
|
||||||
|
y: 256
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this.state.message = {
|
||||||
|
text: "GAME OVER",
|
||||||
|
x: 127,
|
||||||
|
y: 256
|
||||||
|
};
|
||||||
|
}
|
||||||
this.displayHUD();
|
this.displayHUD();
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
|
|
||||||
|
@ -1160,15 +1169,15 @@ GameLib.CustomCode.prototype.extend = function(gameObject, position, orientation
|
||||||
this.gameOver(true);
|
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.extendSpeedGrain = (GameLib.CustomCode.SPEED_INITIAL - GameLib.CustomCode.MAX_SPEED) / ((GameLib.CustomCode.GRID_WIDTH * GameLib.CustomCode.GRID_HEIGHT) - this.snake.length)
|
||||||
|
|
||||||
this.speed -= this.extendSpeedGrain;
|
this.speed -= this.extendSpeedGrain;
|
||||||
|
|
||||||
if (this.speed < GameLib.CustomCode.MAX_SPEED) {
|
if (this.speed < GameLib.CustomCode.MAX_SPEED) {
|
||||||
this.speed = GameLib.CustomCode.MAX_SPEED;
|
this.speed = GameLib.CustomCode.MAX_SPEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('speed = ' + this.speed);
|
console.log('speed = ' + this.speed);
|
||||||
|
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
@ -1224,8 +1233,8 @@ GameLib.CustomCode.prototype.powerup = function(gameObject) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('speed = ' + this.speed);
|
console.log('speed = ' + this.speed);
|
||||||
console.log('animation speed = ' + this.animation.translationSpeed);
|
console.log('animation speed = ' + this.animation.translationSpeed);
|
||||||
|
|
||||||
|
|
||||||
this.powerups.splice(
|
this.powerups.splice(
|
||||||
|
|
Loading…
Reference in New Issue