Update: CC - Snake FS - Entity Loaded (21g30t1e75.js) 337 bytes modified
parent
385f010840
commit
4f32e36bb4
|
@ -226,7 +226,8 @@ this.state = {
|
||||||
gameOver : false,
|
gameOver : false,
|
||||||
muted : false,
|
muted : false,
|
||||||
paused : false,
|
paused : false,
|
||||||
score : 0
|
score : 0,
|
||||||
|
highscore : 0
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.CustomCode.prototype.advanceSpeedTimer = function(delta) {
|
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.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';
|
var score = GameLib.Utils.PaddedText(5, '0', this.state.score + '') + 'cm';
|
||||||
|
|
||||||
|
@ -1951,6 +1954,16 @@ GameLib.Event.Subscribe(
|
||||||
}.bind(this)
|
}.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();
|
this.displayHUD();
|
||||||
window.moveTo(0, 0);
|
window.moveTo(0, 0);
|
||||||
|
|
||||||
|
@ -1975,6 +1988,8 @@ window.scroll(0,0);
|
||||||
maxWindow();
|
maxWindow();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GameLib.Event.Emit(GameLib.Event.GAME_LOADED);
|
GameLib.Event.Emit(GameLib.Event.GAME_LOADED);
|
||||||
|
|
||||||
//@ sourceURL=entityLoaded.js
|
//@ sourceURL=entityLoaded.js
|
Loading…
Reference in New Issue