Adds a line indicating the weapon direction in BattleDudes.io
Stan na
// ==UserScript==
// @name BattleDudes.io Aim Line
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a line indicating the weapon direction in BattleDudes.io
// @author blahblah
// @match *://*.battledudes.io/*
// @license MIT
// @icon https://sun9-74.userapi.com/impg/6jY26kEuZ0qU5I9x7mdBOdQ2zA8pG8H9s3AkDw/BTLz1oDKei0.jpg?size=604x340&quality=96&sign=9fe860f5ff054a01d1ffef1c2f9c79fb&type=album
// @grant play hornex.pro
// ==/UserScript==
(function() {
'use strict';
var aimLine = document.createElement('div');
aimLine.style.position = 'fixed';
aimLine.style.width = '700px';
aimLine.style.height = '3px';
aimLine.style.backgroundColor = 'red';
aimLine.style.zIndex = '9999';
aimLine.style.transformOrigin = 'top left';
aimLine.style.display = 'none';
aimLine.style.pointerEvents = 'none';
document.body.appendChild(aimLine);
function updateAimLine(event) {
var centerX = window.innerWidth / 2;
var centerY = window.innerHeight / 2;
var mouseX = event.clientX;
var mouseY = event.clientY;
var angle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;
aimLine.style.left = centerX + 'px';
aimLine.style.top = centerY + 'px';
aimLine.style.transform = `rotate(${angle}deg)`;
aimLine.style.display = 'block';
}
document.addEventListener('mousemove', updateAimLine);
document.addEventListener('keydown', function(event) {
if (event.key === 'l') {
aimLine.style.display = aimLine.style.display === 'none' ? 'block' : 'none';
}
});
})();