From 3c89b210893f62120cfcf890ab3871adf5ef86f6 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 24 Mar 2018 22:30:50 +0100 Subject: [PATCH] Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 77 bytes modified --- 21g30t1e75.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/21g30t1e75.js b/21g30t1e75.js index 927575d..b8c0233 100644 --- a/21g30t1e75.js +++ b/21g30t1e75.js @@ -225,7 +225,8 @@ this.state = { message : null, gameOver : false, muted : false, - paused : false + paused : false, + score : 0 }; GameLib.CustomCode.prototype.advanceSpeedTimer = function(delta) { @@ -1270,7 +1271,7 @@ GameLib.CustomCode.prototype.extend = function(gameObject, position, orientation this.food.indexOf(gameObject), 1 ); - + gameObject.dispose(); this.grid[body.position.x][body.position.y] = body; @@ -1295,7 +1296,9 @@ GameLib.CustomCode.prototype.extend = function(gameObject, position, orientation this.animation.translationSpeed = GameLib.CustomCode.MAX_ANIMATION_SPEED; } - console.log('speed = ' + this.speed); + this.state.score += (1 - this.speed) * 21; + + //console.log('speed = ' + this.speed); }.bind(this); @@ -1816,7 +1819,8 @@ GameLib.Event.Subscribe( message : null, gameOver : false, muted : this.state.muted, - paused : false + paused : false, + score : 0 }; GameLib.Event.Emit(