Rotate the chars in an infinite loop

This commit is contained in:
Aaron Mueller 2013-05-16 21:28:17 +02:00
parent 4fcad1a9ec
commit 1daf972fb9

View file

@ -31,16 +31,23 @@ ig.module(
update: function() {
// Switch chars
if (ig.input.pressed('prev-char') && this.highlightedChar > 0)
if (ig.input.pressed('prev-char') && this.highlightedChar > 0) {
this.highlightedChar--;
}
if (ig.input.pressed('next-char') && this.highlightedChar < this.numberOfChars-1)
this.highlightedChar++;
// Switch symbols
if (ig.input.pressed('prev-symbol') && this._name[this.highlightedChar] > 0)
if (ig.input.pressed('prev-symbol')) {
this._name[this.highlightedChar]--;
if (ig.input.pressed('next-symbol') && this._name[this.highlightedChar] < this.symbols.length-1)
if (this._name[this.highlightedChar] < 0)
this._name[this.highlightedChar] = this.symbols.length-1;
}
if (ig.input.pressed('next-symbol')) {
this._name[this.highlightedChar]++;
if (this._name[this.highlightedChar] == this.symbols.length)
this._name[this.highlightedChar] = 0;
}
this.parent();
},