56 lines
846 B
JavaScript
56 lines
846 B
JavaScript
if (!this.entityLoaded) {
|
|
return;
|
|
}
|
|
|
|
if (!this.initialized) {
|
|
|
|
this.state = this.entityLoaded.state;
|
|
|
|
this.initialized = true;
|
|
|
|
}
|
|
|
|
var touch = data;
|
|
var max = Math.max(touch.left, touch.right, touch.up, touch.down);
|
|
|
|
if (typeof max === 'number') {
|
|
|
|
if (max === touch.left) {
|
|
GameLib.Event.Emit(
|
|
GameLib.Event.KEY_DOWN,
|
|
{
|
|
keyCode : GameLib.System.Input.KEY_LEFT
|
|
}
|
|
);
|
|
}
|
|
|
|
if (max === touch.right) {
|
|
GameLib.Event.Emit(
|
|
GameLib.Event.KEY_DOWN,
|
|
{
|
|
keyCode : GameLib.System.Input.KEY_RIGHT
|
|
}
|
|
);
|
|
}
|
|
|
|
if (max === touch.up) {
|
|
GameLib.Event.Emit(
|
|
GameLib.Event.KEY_DOWN,
|
|
{
|
|
keyCode : GameLib.System.Input.KEY_UP
|
|
}
|
|
);
|
|
}
|
|
|
|
if (max === touch.down) {
|
|
GameLib.Event.Emit(
|
|
GameLib.Event.KEY_DOWN,
|
|
{
|
|
keyCode : GameLib.System.Input.KEY_DOWN
|
|
}
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
//@ sourceURL=touchEnd.js
|