From b3053069a49b8db0c447ebf3d6e4025669c594d9 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sun, 18 Feb 2018 21:35:46 +0100 Subject: [PATCH] Initial Commit: CC - Bacon - Touch End (cgw7pwx0jg.js) --- cgw7pwx0jg.js | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 cgw7pwx0jg.js diff --git a/cgw7pwx0jg.js b/cgw7pwx0jg.js new file mode 100644 index 0000000..4ea9a75 --- /dev/null +++ b/cgw7pwx0jg.js @@ -0,0 +1,65 @@ +if (GameLib.Utils.UndefinedOrNull(this.entityLoaded)) { + return; +} + +var touch = data; +var max = Math.max(touch.left, touch.right, touch.up, touch.down); + +var units = Math.floor(max / 150) + 1; + +if (typeof max === 'number') { + + if (max < 5) { + GameLib.Event.Emit( + GameLib.Event.KEY_DOWN, + { + code : 'ArrowUp' + } + ); + } else { + + if (max === touch.left) { + for (var i = 0; i < units; i++) { + GameLib.Event.Emit( + GameLib.Event.KEY_DOWN, + { + code : 'ArrowLeft' + } + ); + } + } + + if (max === touch.right) { + for (var i = 0; i < units; i++) { + GameLib.Event.Emit( + GameLib.Event.KEY_DOWN, + { + code : 'ArrowRight' + } + ); + } + } + + if (max === touch.up) { + GameLib.Event.Emit( + GameLib.Event.KEY_DOWN, + { + code : 'ArrowUp' + } + ); + } + + if (max === touch.down) { + GameLib.Event.Emit( + GameLib.Event.KEY_DOWN, + { + code : 'Space' + } + ); + } + + } +} + + +//# sourceURL=touchEnd.js \ No newline at end of file