Rotate the chars in an infinite loop
This commit is contained in:
parent
4fcad1a9ec
commit
1daf972fb9
1 changed files with 10 additions and 3 deletions
|
@ -31,16 +31,23 @@ ig.module(
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
// Switch chars
|
// Switch chars
|
||||||
if (ig.input.pressed('prev-char') && this.highlightedChar > 0)
|
if (ig.input.pressed('prev-char') && this.highlightedChar > 0) {
|
||||||
this.highlightedChar--;
|
this.highlightedChar--;
|
||||||
|
}
|
||||||
if (ig.input.pressed('next-char') && this.highlightedChar < this.numberOfChars-1)
|
if (ig.input.pressed('next-char') && this.highlightedChar < this.numberOfChars-1)
|
||||||
this.highlightedChar++;
|
this.highlightedChar++;
|
||||||
|
|
||||||
// Switch symbols
|
// Switch symbols
|
||||||
if (ig.input.pressed('prev-symbol') && this._name[this.highlightedChar] > 0)
|
if (ig.input.pressed('prev-symbol')) {
|
||||||
this._name[this.highlightedChar]--;
|
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]++;
|
this._name[this.highlightedChar]++;
|
||||||
|
if (this._name[this.highlightedChar] == this.symbols.length)
|
||||||
|
this._name[this.highlightedChar] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
this.parent();
|
this.parent();
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue