🖱️ Mouse

What is it?

The global mouse object stores the current mouse state inside the canvas. It includes its position, click status and wheel scrolling. It is accessible from any script.

📖 Properties

✅ Example

if (mouse.down) {
  console.log("Click at:", mouse.x, mouse.y);
}

// Get world position
const worldPos = ScreenToWorld(mouse.x, mouse.y);
console.log("World position:", worldPos.x, worldPos.y);

📌 Notes

- The mouse system initializes automatically with the main canvas.
- It always returns positions relative to the visible canvas.
- Combine it with ScreenToWorld() to get accurate world coordinates when the camera moves.