Set the right position for the namefield

This commit is contained in:
Aaron Mueller 2013-05-16 22:26:06 +02:00
parent fa057f8efe
commit a8bec468d5

View file

@ -123,7 +123,7 @@ ig.module(
init: function() { init: function() {
ig.input.bind(ig.KEY.ENTER, 'submit-score'); ig.input.bind(ig.KEY.ENTER, 'submit-score');
ig.input.bind(ig.KEY.ESCAPE, 'main-menu'); ig.input.bind(ig.KEY.ESCAPE, 'main-menu');
this.nameField = ig.game.spawnEntity(EntityNameField, 250, 150); this.nameField = ig.game.spawnEntity(EntityNameField, 363, 219);
this.loadScores(); this.loadScores();
}, },
@ -132,7 +132,7 @@ ig.module(
ig.system.setGame(StartScreen); ig.system.setGame(StartScreen);
} }
if (ig.input.pressed('submit-score')) { if (ig.input.pressed('submit-score') && this.nameField !== null) {
this.saveScore(this.nameField.name(), ig.global.score, function(context) { this.saveScore(this.nameField.name(), ig.global.score, function(context) {
setTimeout(function() { context.loadScores(); }, 2000); setTimeout(function() { context.loadScores(); }, 2000);
}); });
@ -173,7 +173,7 @@ ig.module(
} }
} }
if (this.nameField !== null) this.nameField.draw(260, 200); if (this.nameField !== null) this.nameField.draw();
this.font.draw(ig.global.score, 485, 150, ig.Font.ALIGN.RIGHT); this.font.draw(ig.global.score, 485, 150, ig.Font.ALIGN.RIGHT);
} }
}); });