🍣🎄 Checkpoint

./server.js:9949330/587
This commit is contained in:
Glitch (hello-express) 2020-03-16 02:30:19 +00:00
parent c44d4fdc7a
commit ba241e0ac0
1 changed files with 16 additions and 6 deletions

View File

@ -58,16 +58,22 @@ client.on("a", (msg) => {
cursormode = "none";
pos = {x: -500, y: -500};
break;
default:
chat("invalid :P");
break;
}
}
break;
case "dvd!stats":
chat("Edge hits: " + edgehits + " | Corner hits: " + cornerhits);
break;
}
});
var pos = {x: -42, y: 5};
var pos = {x: (Math.random() * 100) - 50, y: (Math.random() * 100) - 50};
var vel = {x: 2/5, y: 2/7};
var cornerhits;
var edgehits;
var cornerhits = 0;
var edgehits = 0;
var cursor = setInterval(function() {
client.sendArray([{m:'m', x: client.getOwnParticipant().x = pos.x + 50, y: client.getOwnParticipant().y = pos.y + 50}]);
@ -90,13 +96,17 @@ var cursorupdate = setInterval(function() {
if (pos.y <= -50) {
vel.y = -vel.y;
}
if (pos.x == -50 && pos.y == -50) {
if (pos.x <= -50 && pos.y >= -50) {
cornerhits += 1;
} else if (pos.x == -50 || pos.x == 50) {
chat("test corner");
} else if (pos.x <= -50 || pos.x >= 50) {
edgehits += 1;
} else if (pos.y == -50 || pos.y == 50) {
chat("test edge");
} else if (pos.y <= -50 || pos.y >= 50) {
edgehits += 1;
chat("test edge")
}
break;
}
console.log(pos.x + " : " + pos.y);
}, 25);