Update: CC - Snake FS - Touch End (0j2wxrtdf2.js) 658 bytes modified

beta.r3js.org
-=yb4f310 2018-03-24 16:28:45 +01:00
parent 44c576abf2
commit 5a74c5308e
1 changed files with 42 additions and 1 deletions

View File

@ -10,6 +10,47 @@ if (!this.initialized) {
}
console.log(data);
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