Closed DaAwesomeRazor closed 8 years ago
Emm, you want to read mouse coordinates? Explain, please.
FYI, case 32 is "Owns blob" opcode that server sends to client 1.
@xzfc Im an idiot just saying. THey are stored in vairable wa and va in the main.js.
Mouse coordinates. I am making bots and i need the bots to follow mouse. I made my own custom main.js and it is stored in function Ra() and vairables wa and va. I like using the script better though
I think this is what you want
@jakemayeux @xzfc I mean mouse coordinates. like the ones for bots. I need ones for my bots.
Look at this:
var transform
var coords
function toWorldCoords(pixelCoords) {
var x = (pixelCoords.x - transform.x) / transform.scale
var y = (pixelCoords.y - transform.y) / transform.scale
return {x, y}
}
agar.hooks.beforeTransform = (ctx, t1x, t1y, s, t2x, t2y) =>
transform = {scale:s, x:t2x*s + t1x, y:t2y*s + t1y}
canvas.addEventListener("mousemove", e => coords = {x:e.x, y:e.y})
setInterval(() => console.log(toWorldCoords(coords)), 100)
Works...
As in the title