🕍⏱ Checkpoint

./server.js:9949330/1025
This commit is contained in:
Glitch (hello-express) 2020-03-11 19:54:22 +00:00
parent 60fdea6d5b
commit c47d37f7a4
1 changed files with 42 additions and 18 deletions

View File

@ -27,6 +27,8 @@ function chat(string) {
var ctoggle = true; var ctoggle = true;
var cursormode = "dvd";
client.on("a", (msg) => { client.on("a", (msg) => {
let args = msg.a.split(' '); let args = msg.a.split(' ');
let cmd = args[0].toLowerCase(); let cmd = args[0].toLowerCase();
@ -34,9 +36,25 @@ client.on("a", (msg) => {
switch (cmd) { switch (cmd) {
case "dvd!help": case "dvd!help":
chat("not finished :)"); chat("cmds: dvd!help // dvd!cursor");
break;
case "dvd!cursor":
if (!argcat || argcat == "") {
chat("Modes: on // off");
} else {
switch (argcat) {
case "on":
ctoggle = true;
pos = {x: 5, y: 5};
cursormode = "dvd";
break;
case "off":
ctoggle = false;
cursormode = "none";
break;
}
}
break; break;
case "dvd!cursor"
} }
}); });
@ -47,12 +65,14 @@ var cursor = setInterval(function() {
if (ctoggle == true) { 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 { } else {
pos.x = 200; pos.x = -150;
pos.y = 200; pos.y = -150;
} }
}); });
var cursorupdate = setInterval(function() { var cursorupdate = setInterval(function() {
switch (cursormode) {
case "dvd":
pos.x += vel.x; pos.x += vel.x;
pos.y += vel.y; pos.y += vel.y;
if (pos.x >= 50) { if (pos.x >= 50) {
@ -67,4 +87,8 @@ var cursorupdate = setInterval(function() {
if (pos.y <= -50) { if (pos.y <= -50) {
vel.y = -vel.y; vel.y = -vel.y;
} }
break;
case "off":
}
}, 25); }, 25);