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

beta.r3js.org
-=yb4f310 2018-03-24 22:42:37 +01:00
parent 385f010840
commit 4f32e36bb4
1 changed files with 17 additions and 2 deletions

View File

@ -226,7 +226,8 @@ this.state = {
gameOver : false,
muted : false,
paused : false,
score : 0
score : 0,
highscore : 0
};
GameLib.CustomCode.prototype.advanceSpeedTimer = function(delta) {
@ -261,7 +262,9 @@ GameLib.CustomCode.prototype.displayHUD = function() {
this.canvasHUD.line(50, 38, 462, 38, 2, "#000000");
this.canvasHUD.text('hiscore', 50, 32, '15px Pixeled', '#ffffff');
var highscore = GameLib.Utils.PaddedText(5, '0', this.state.highscore + '') + 'cm';
this.canvasHUD.text('hiscore ' + highscore + 'cm', 50, 32, '15px Pixeled', '#ffffff');
var score = GameLib.Utils.PaddedText(5, '0', this.state.score + '') + 'cm';
@ -1951,6 +1954,16 @@ GameLib.Event.Subscribe(
}.bind(this)
)
GameLib.Event.Subscribe(
GameLib.Event.CUSTOM_DATA,
function(data) {
if (data.type === 'highscore') {
this.state.highscore = data.highscore;
this.displayHUD();
}
}.bind(this)
)
this.displayHUD();
window.moveTo(0, 0);
@ -1975,6 +1988,8 @@ window.scroll(0,0);
maxWindow();
GameLib.Event.Emit(GameLib.Event.GAME_LOADED);
//@ sourceURL=entityLoaded.js