From 5e0008964dddc80f7810d4c8d9a7f836565e8427 Mon Sep 17 00:00:00 2001 From: "Glitch (hello-express)" Date: Wed, 11 Mar 2020 20:06:20 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=A6=E2=9C=82=EF=B8=8F=20Checkpoint=20.?= =?UTF-8?q?/server.js:9949330/666?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/server.js b/server.js index c8de9c3..9ed9105 100644 --- a/server.js +++ b/server.js @@ -40,17 +40,25 @@ client.on("a", (msg) => { break; case "dvd!cursor": if (!argcat || argcat == "") { - chat("Modes: on // off"); + chat("Modes: on // off // frantic"); } else { switch (argcat) { case "on": ctoggle = true; pos = {x: 5, y: 5}; + vel = {x: 2/5, y: 2/7}; cursormode = "dvd"; break; case "off": ctoggle = false; cursormode = "none"; + pos = {x: -500, y: -500}; + break; + case "frantic": + ctoggle = true; + pos = {x: 5, y: 5}; + vel = {x: 10, y: 15}; + cursormode = "frantic"; break; } } @@ -62,17 +70,13 @@ var pos = {x: -42, y: 5}; var vel = {x: 2/5, y: 2/7}; var cursor = setInterval(function() { - if (ctoggle == true) { - client.sendArray([{m:'m', x: client.getOwnParticipant().x = pos.x + 50, y: client.getOwnParticipant().y = pos.y + 50}]) - } else { - pos.x = -150; - pos.y = -150; - } + client.sendArray([{m:'m', x: client.getOwnParticipant().x = pos.x + 50, y: client.getOwnParticipant().y = pos.y + 50}]); }); var cursorupdate = setInterval(function() { switch (cursormode) { case "dvd": + case "frantic": pos.x += vel.x; pos.y += vel.y; if (pos.x >= 50) { @@ -88,7 +92,7 @@ var cursorupdate = setInterval(function() { vel.y = -vel.y; } break; - case "off": - } + + }, 25); \ No newline at end of file