diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/jarvis.js | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/examples/jarvis.js b/examples/jarvis.js index 49c425a..2294d7a 100644 --- a/examples/jarvis.js +++ b/examples/jarvis.js @@ -12,17 +12,13 @@ const ri = require('../utils/rectintersect'); var main = new Socket(); -function equals(arg1,arg2){ // Just takes the specific case argument of each being an int pair - return arg1[0] == arg2[0] && arg1[1] == arg2[1] -} - main.on('open', ()=>{ // Tries to identify itself with a cursor movement console.log('socket opened'); let coords = [Math.floor(Math.random()*100000+16),Math.floor(Math.random()*100000+16)]; main.cursor(coords); main.on('cursor',detect); function detect(pos, send){ - if (equals(pos[0],coords)){ + if (vec.equals(pos[0],coords)){ main.off('cursor', detect); identity(send); } |