🌦✂️ Checkpoint

./server.js:9949330/666
This commit is contained in:
Glitch (hello-express) 2020-03-11 20:06:20 +00:00
parent c47d37f7a4
commit 5e0008964d
1 changed files with 13 additions and 9 deletions

View File

@ -40,17 +40,25 @@ client.on("a", (msg) => {
break; break;
case "dvd!cursor": case "dvd!cursor":
if (!argcat || argcat == "") { if (!argcat || argcat == "") {
chat("Modes: on // off"); chat("Modes: on // off // frantic");
} else { } else {
switch (argcat) { switch (argcat) {
case "on": case "on":
ctoggle = true; ctoggle = true;
pos = {x: 5, y: 5}; pos = {x: 5, y: 5};
vel = {x: 2/5, y: 2/7};
cursormode = "dvd"; cursormode = "dvd";
break; break;
case "off": case "off":
ctoggle = false; ctoggle = false;
cursormode = "none"; 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; break;
} }
} }
@ -62,17 +70,13 @@ var pos = {x: -42, y: 5};
var vel = {x: 2/5, y: 2/7}; var vel = {x: 2/5, y: 2/7};
var cursor = setInterval(function() { 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}]);
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;
}
}); });
var cursorupdate = setInterval(function() { var cursorupdate = setInterval(function() {
switch (cursormode) { switch (cursormode) {
case "dvd": case "dvd":
case "frantic":
pos.x += vel.x; pos.x += vel.x;
pos.y += vel.y; pos.y += vel.y;
if (pos.x >= 50) { if (pos.x >= 50) {
@ -88,7 +92,7 @@ var cursorupdate = setInterval(function() {
vel.y = -vel.y; vel.y = -vel.y;
} }
break; break;
case "off":
} }
}, 25); }, 25);