Update: CC - Snake FS - Touch End (0j2wxrtdf2.js) 658 bytes modified
parent
44c576abf2
commit
5a74c5308e
|
@ -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
|
//@ sourceURL=touchEnd.js
|
Loading…
Reference in New Issue