mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-26 03:38:58 +00:00
Input system fix
This commit is contained in:
parent
5ca0f53063
commit
6ad522a79d
@ -27,16 +27,16 @@ export class KeyboardInput implements IInput {
|
|||||||
private onKeyDown(event: EventKeyboard): void {
|
private onKeyDown(event: EventKeyboard): void {
|
||||||
switch (event.keyCode) {
|
switch (event.keyCode) {
|
||||||
case this.up:
|
case this.up:
|
||||||
this.yAxis += 1;
|
this.yAxis = 1;
|
||||||
break;
|
break;
|
||||||
case this.down:
|
case this.down:
|
||||||
this.yAxis += -1;
|
this.yAxis = -1;
|
||||||
break;
|
break;
|
||||||
case this.left:
|
case this.left:
|
||||||
this.xAxis += -1;
|
this.xAxis = -1;
|
||||||
break;
|
break;
|
||||||
case this.right:
|
case this.right:
|
||||||
this.xAxis += 1;
|
this.xAxis = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,16 +44,16 @@ export class KeyboardInput implements IInput {
|
|||||||
private onKeyUp(event: EventKeyboard): void {
|
private onKeyUp(event: EventKeyboard): void {
|
||||||
switch (event.keyCode) {
|
switch (event.keyCode) {
|
||||||
case this.up:
|
case this.up:
|
||||||
this.yAxis -= 1;
|
this.yAxis = this.yAxis === 1 ? 0 : this.yAxis;
|
||||||
break;
|
break;
|
||||||
case this.down:
|
case this.down:
|
||||||
this.yAxis -= -1;
|
this.yAxis = this.yAxis === -1 ? 0 : this.yAxis;
|
||||||
break;
|
break;
|
||||||
case this.left:
|
case this.left:
|
||||||
this.xAxis -= -1;
|
this.xAxis = this.xAxis === -1 ? 0 : this.xAxis;
|
||||||
break;
|
break;
|
||||||
case this.right:
|
case this.right:
|
||||||
this.xAxis -= 1;
|
this.xAxis = this.xAxis === 1 ? 0 : this.xAxis;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user