Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 75 bytes modified
parent
e5e8ec9c54
commit
a7939f8e07
|
@ -181,28 +181,28 @@ this.state = {
|
|||
|
||||
GameLib.CustomCode.prototype.advanceSpeedTimer = function(delta) {
|
||||
|
||||
this.speedTimer += delta;
|
||||
|
||||
if (this.speedTimer < GameLib.CustomCode.SPEED_INCREASE_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.speedTimer = 0;
|
||||
|
||||
this.speed -= GameLib.CustomCode.SPEED_GRAIN;
|
||||
this.speedTimer += delta;
|
||||
|
||||
if (this.speed < GameLib.CustomCode.MAX_SPEED) {
|
||||
this.speed = GameLib.CustomCode.MAX_SPEED;
|
||||
}
|
||||
if (this.speedTimer < GameLib.CustomCode.SPEED_INCREASE_INTERVAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.animation.translationSpeed += GameLib.CustomCode.ANIMATION_SPEED_GRAIN;
|
||||
this.speedTimer = 0;
|
||||
|
||||
this.speed -= GameLib.CustomCode.SPEED_GRAIN;
|
||||
|
||||
if (this.speed < GameLib.CustomCode.MAX_SPEED) {
|
||||
this.speed = GameLib.CustomCode.MAX_SPEED;
|
||||
}
|
||||
|
||||
this.animation.translationSpeed += GameLib.CustomCode.ANIMATION_SPEED_GRAIN;
|
||||
|
||||
if (this.animation.translationSpeed > GameLib.CustomCode.MAX_ANIMATION_SPEED) {
|
||||
this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED;
|
||||
}
|
||||
|
||||
console.log(this.animation.translationSpeed + ':' + this.speed );
|
||||
|
||||
if (this.animation.translationSpeed > GameLib.CustomCode.MAX_ANIMATION_SPEED) {
|
||||
this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED;
|
||||
}
|
||||
|
||||
console.log(this.animation.translationSpeed + ':' + this.speed );
|
||||
|
||||
}.bind(this)
|
||||
|
||||
GameLib.CustomCode.prototype.displayHUD = function() {
|
||||
|
@ -1206,15 +1206,15 @@ GameLib.CustomCode.prototype.extend = function(gameObject, position, orientation
|
|||
this.extendSpeedGrain = (GameLib.CustomCode.SPEED_INITIAL - GameLib.CustomCode.MAX_SPEED) / ((GameLib.CustomCode.GRID_WIDTH * GameLib.CustomCode.GRID_HEIGHT) - this.snake.length)
|
||||
|
||||
var animationSpeedGrain = (GameLib.CustomCode.MAX_ANIMATION_SPEED - GameLib.CustomCode.MIN_ANIMATION_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;
|
||||
}
|
||||
|
||||
|
||||
this.animation.translationSpeed += animationSpeedGrain;
|
||||
|
||||
|
||||
if (this.animation.translationSpeed > GameLib.CustomCode.MAX_ANIMATION_SPEED) {
|
||||
this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED;
|
||||
}
|
||||
|
@ -1245,13 +1245,13 @@ GameLib.CustomCode.prototype.powerup = function(gameObject) {
|
|||
|
||||
if (gameObject.type === GameLib.CustomCode.POWERUP_SPEED) {
|
||||
|
||||
this.speed -= GameLib.CustomCode.SPEED_GRAIN;
|
||||
this.speed -= GameLib.CustomCode.POWERUP_SPEED_GRAIN;
|
||||
|
||||
if (this.speed < GameLib.CustomCode.MAX_SPEED) {
|
||||
this.speed = GameLib.CustomCode.MAX_SPEED;
|
||||
}
|
||||
|
||||
this.animation.translationSpeed += GameLib.CustomCode.ANIMATION_SPEED_GRAIN;
|
||||
this.animation.translationSpeed += GameLib.CustomCode.POWERUP_ANIMATION_SPEED_GRAIN;
|
||||
|
||||
if (this.animation.translationSpeed > GameLib.CustomCode.MAX_ANIMATION_SPEED) {
|
||||
this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED;
|
||||
|
@ -1261,13 +1261,13 @@ GameLib.CustomCode.prototype.powerup = function(gameObject) {
|
|||
|
||||
if (gameObject.type === GameLib.CustomCode.POWERUP_SLOW) {
|
||||
|
||||
this.speed += GameLib.CustomCode.SPEED_GRAIN;
|
||||
this.speed += GameLib.CustomCode.POWERUP_SPEED_GRAIN;
|
||||
|
||||
if (this.speed > GameLib.CustomCode.MIN_SPEED) {
|
||||
this.speed = GameLib.CustomCode.MIN_SPEED;
|
||||
}
|
||||
|
||||
this.animation.translationSpeed -= GameLib.CustomCode.ANIMATION_SPEED_GRAIN;
|
||||
this.animation.translationSpeed -= GameLib.CustomCode.POWERUP_ANIMATION_SPEED_GRAIN;
|
||||
|
||||
if (this.animation.translationSpeed < GameLib.CustomCode.MIN_ANIMATION_SPEED) {
|
||||
this.animation.translationSpeed = GameLib.CustomCode.MIN_ANIMATION_SPEED;
|
||||
|
@ -1777,8 +1777,8 @@ GameLib.Event.Subscribe(
|
|||
GameLib.CustomCode.POWERUP_WAIT_TIME_MAX
|
||||
);
|
||||
|
||||
this.explodeTime = 0;
|
||||
this.speedTimer = 0;
|
||||
this.explodeTime = 0;
|
||||
this.speedTimer = 0;
|
||||
|
||||
/**
|
||||
* Re-initialize our other custom code components
|
||||
|
|
Loading…
Reference in New Issue