🕍⏱ 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 cursormode = "dvd";
client.on("a", (msg) => {
let args = msg.a.split(' ');
let cmd = args[0].toLowerCase();
@ -34,9 +36,25 @@ client.on("a", (msg) => {
switch (cmd) {
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;
case "dvd!cursor"
}
});
@ -47,24 +65,30 @@ 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 = 200;
pos.y = 200;
pos.x = -150;
pos.y = -150;
}
});
var cursorupdate = setInterval(function() {
pos.x += vel.x;
pos.y += vel.y;
if (pos.x >= 50) {
vel.x = -vel.x;
}
if (pos.y >= 50) {
vel.y = -vel.y;
}
if (pos.x <= -50) {
vel.x = -vel.x;
}
if (pos.y <= -50) {
vel.y = -vel.y;
}
switch (cursormode) {
case "dvd":
pos.x += vel.x;
pos.y += vel.y;
if (pos.x >= 50) {
vel.x = -vel.x;
}
if (pos.y >= 50) {
vel.y = -vel.y;
}
if (pos.x <= -50) {
vel.x = -vel.x;
}
if (pos.y <= -50) {
vel.y = -vel.y;
}
break;
case "off":
}
}, 25);