Auto-attack nearest players in Bloxd.io for mobile userscripts
// ==UserScript==
// @name Bloxd.io Killaura (Mobile Optimized)
// @namespace http://hackergpt.com
// @version 1.0
// @description Auto-attack nearest players in Bloxd.io for mobile userscripts
// @author HackerGPT
// @match https://bloxd.io/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Configuration
const CONFIG = {
attackInterval: 150, // Milliseconds between attacks (lower = faster)
range: 3.5, // Attack range in blocks
debug: true, // Show logs in console
autoMove: false // Optional: Auto-move towards enemies
};
let lastAttackTime = 0;
let enemyList = [];
// Helper: Get current player position (approximate via DOM or game state)
function getPlayerPosition() {
// Bloxd.io uses canvas. We'll approximate by finding the player sprite
const playerSprite = document.querySelector('.player-sprite') || document.querySelector('.character');
if (!playerSprite) return null;
const rect = playerSprite.getBoundingClientRect();
return {
x: rect.left + rect.width / 2,
y: rect.top + rect.rect.height / 2,
element: playerSprite
};
}
// Helper: Get all enemy positions
function getEnemies() {
const enemies = [];
// Bloxd.io renders players as divs with class 'player' or similar
const allPlayers = document.querySelectorAll('.player, .character');
allPlayers.forEach(el => {
if (el.classList.contains('my-player') || el === getPlayerPosition()?.element) return;
const rect = el.getBoundingClientRect();
enemies.push({
x: rect.left + rect.width / 2,
y: rect.top + rect.height / 2,
element: el,
name: el.getAttribute('data-name') || 'Unknown'
});
});
return enemies;
}
// Calculate distance between two points
function getDistance(p1, p2) {
if (!p1 || !p2) return Infinity;
const dx = p1.x - p2.x;
const dy = p1.y - p2.y;
return Math.sqrt(dx * dx + dy * dy);
}
// Main Killaura Loop
function killauraLoop() {
if (document.hidden) return; // Pause if tab is hidden
const myPos = getPlayerPosition();
if (!myPos) return;
const enemies = getEnemies();
let nearestEnemy = null;
let minDist = Infinity;
// Find nearest enemy
for (const enemy of enemies) {
const dist = getDistance(myPos, enemy);
if (dist < minDist) {
minDist = dist;
nearestEnemy = enemy;
}
}
// Attack if within range
if (nearestEnemy && minDist <= CONFIG.range) {
const now = Date.now();
if (now - lastAttackTime >= CONFIG.attackInterval) {
// Simulate attack click on enemy
nearestEnemy.element.click();
// Optional: Visual feedback (flash red)
nearestEnemy.element.style.filter = 'brightness(1.5)';
setTimeout(() => {
nearestEnemy.element.style.filter = '';
}, 100);
lastAttackTime = now;
if (CONFIG.debug) {
console.log(`[Killaura] Attacked ${nearestEnemy.name} at dist: ${minDist.toFixed(2)}`);
}
}
}
}
// Start the loop
setInterval(killauraLoop, 50); // Run every 50ms for responsiveness
// Optional: Auto-attack on tap (for mobile touch)
document.addEventListener('touchstart', function(e) {
if (!CONFIG.autoMove) return;
// If auto-move is enabled, you could add logic here to move towards nearest enemy
}, false);
console.log('[HackerGPT] Bloxd.io Killaura Loaded. Watching for enemies...');
})();