r3-custom-code/0j2wxrtdf2.js

52 lines
801 B
JavaScript
Raw Normal View History

if (!this.entityLoaded) {
return;
}
if (!this.initialized) {
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