Fix the ESC key and add some VIM keybindings

This commit is contained in:
Aaron Mueller 2013-05-16 22:35:32 +02:00
parent a8bec468d5
commit de89e86fa1
2 changed files with 7 additions and 6 deletions

View file

@ -13,20 +13,21 @@ ig.module(
symbols: ['_', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'], symbols: ['_', 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
numberOfChars: 3, numberOfChars: 3,
highlightedChar: 0, highlightedChar: 0,
_name: [], _name: [1, 0, 0],
init: function(x, y, settings) { init: function(x, y, settings) {
this.parent(x, y, settings); this.parent(x, y, settings);
ig.input.bind(ig.KEY.RIGHT_ARROW, 'next-char'); ig.input.bind(ig.KEY.RIGHT_ARROW, 'next-char');
ig.input.bind(ig.KEY.LEFT_ARROW, 'prev-char'); ig.input.bind(ig.KEY.LEFT_ARROW, 'prev-char');
ig.input.bind(ig.KEY.UP_ARROW, 'next-symbol'); ig.input.bind(ig.KEY.UP_ARROW, 'next-symbol');
ig.input.bind(ig.KEY.DOWN_ARROW, 'prev-symbol'); ig.input.bind(ig.KEY.DOWN_ARROW, 'prev-symbol');
this._name = []; // VIM goodness
for(var i=0; i<this.numberOfChars; i++) ig.input.bind(ig.KEY.H, 'prev-char');
this._name.push(1); ig.input.bind(ig.KEY.J, 'prev-symbol');
ig.input.bind(ig.KEY.K, 'next-symbol');
ig.input.bind(ig.KEY.L, 'next-char');
}, },
update: function() { update: function() {

View file

@ -122,7 +122,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.ESC, 'main-menu');
this.nameField = ig.game.spawnEntity(EntityNameField, 363, 219); this.nameField = ig.game.spawnEntity(EntityNameField, 363, 219);
this.loadScores(); this.loadScores();
}, },