try to take over the world!
< Commentaires sur Diep Factory Controls Overlay
I found the problem: Here's a fixed version:// ==UserScript==// @name Diep Factory Controls Overlay// @namespace http://tampermonkey.net/// @version 0.1// @description try to take over the world! (fixed by SolarTheBear)// @author adasba, 325 Gerbils, and SolarTheBear// @match *://diep.io/*// @grant unsafeWindow// ==/UserScript==(function() { 'use strict'; window.onload = init; var mouseX, mouseY; function init() { if (window.Event) { document.captureEvents(Event.MOUSEMOVE); } document.onmousemove = getCursorXY; } function getCursorXY(e) { mouseX = e.screenX*2 mouseY = e.screenY*2-297; } var c2 = document.createElement('canvas'); c2.style = "position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:-1;"; document.getElementsByTagName('body')[0].appendChild(c2); var ctx2 = c2.getContext('2d'); var c = document.getElementById('canvas'); var ctx = c.getContext('2d'); c.style.opacity = 0; c2.width = c.width; c2.height = c.height; window.addEventListener('resize', function() { c2.width = c.width; c2.height = c.height; }, false); function loop() { ctx2.clearRect(0, 0, c2.width, c2.height); ctx2.drawImage(c, 0, 0, c2.width, c2.height); var radius = c2.width*0.16751239669; ctx2.beginPath(); ctx2.arc(mouseX, mouseY, radius, 0, 2 * Math.PI); ctx2.fillStyle = 'transparent'; ctx2.fill(); ctx2.lineWidth = 5; ctx2.strokeStyle = 'rgba(255,0,0,0.25)'; ctx2.stroke(); radius = c2.width*0.06545454545; ctx2.beginPath(); ctx2.arc(mouseX, mouseY, radius, 0, 2 * Math.PI); ctx2.fillStyle = 'transparent'; ctx2.fill(); ctx2.lineWidth = 5; ctx2.strokeStyle = 'rgba(0,128,255,0.25)'; ctx2.stroke(); //creates a line from center to mouse coordinate to check if point is correct //ctx2.beginPath(); //ctx2.moveTo(c2.width/2, c2.height/2); //ctx2.lineTo(mouseX, mouseY); //ctx2.strokeStyle = 'rgba(0,0,0)'; //ctx2.stroke(); requestAnimationFrame(loop); } loop();})();
Connectez-vous pour poster une réponse.
I found the problem: Here's a fixed version:
// ==UserScript==
// @name Diep Factory Controls Overlay
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world! (fixed by SolarTheBear)
// @author adasba, 325 Gerbils, and SolarTheBear
// @match *://diep.io/*
// @grant unsafeWindow
// ==/UserScript==
(function() {
'use strict';
window.onload = init;
var mouseX, mouseY;
function init() {
if (window.Event) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = getCursorXY;
}
function getCursorXY(e) {
mouseX = e.screenX*2
mouseY = e.screenY*2-297;
}
var c2 = document.createElement('canvas');
c2.style = "position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:-1;";
document.getElementsByTagName('body')[0].appendChild(c2);
var ctx2 = c2.getContext('2d');
var c = document.getElementById('canvas');
var ctx = c.getContext('2d');
c.style.opacity = 0;
c2.width = c.width;
c2.height = c.height;
window.addEventListener('resize', function() {
c2.width = c.width;
c2.height = c.height;
}, false);
function loop() {
ctx2.clearRect(0, 0, c2.width, c2.height);
ctx2.drawImage(c, 0, 0, c2.width, c2.height);
var radius = c2.width*0.16751239669;
ctx2.beginPath();
ctx2.arc(mouseX, mouseY, radius, 0, 2 * Math.PI);
ctx2.fillStyle = 'transparent';
ctx2.fill();
ctx2.lineWidth = 5;
ctx2.strokeStyle = 'rgba(255,0,0,0.25)';
ctx2.stroke();
radius = c2.width*0.06545454545;
ctx2.beginPath();
ctx2.arc(mouseX, mouseY, radius, 0, 2 * Math.PI);
ctx2.fillStyle = 'transparent';
ctx2.fill();
ctx2.lineWidth = 5;
ctx2.strokeStyle = 'rgba(0,128,255,0.25)';
ctx2.stroke();
//creates a line from center to mouse coordinate to check if point is correct
//ctx2.beginPath();
//ctx2.moveTo(c2.width/2, c2.height/2);
//ctx2.lineTo(mouseX, mouseY);
//ctx2.strokeStyle = 'rgba(0,0,0)';
//ctx2.stroke();
requestAnimationFrame(loop);
}
loop();
})();