Hitbox

Description

The hitbox command creates an invisible collision detection area. It can be used to check if specific coordinates (like the mouse position) intersect with the defined area. Hitboxes are positioned relative to the current draw cursor position.

Syntax

hitbox width height checkx checky
hitbox "show"  // Makes all hitboxes visible
hitbox "hide"  // Makes all hitboxes invisible again

Parameters

  • width: Width of the hitbox in pixels

  • height: Height of the hitbox in pixels

  • checkx: X-coordinate to check for collision

  • checky: Y-coordinate to check for collision

Or:

  • "show": Shows all hitboxes (for debugging)

  • "hide": Hides all hitboxes

Usage Examples

Important Notes

  • The collided variable is automatically set after each hitbox check

  • Hitboxes are invisible by default

  • Multiple hitboxes can be active at once

  • The collision area is a rectangle

  • Coordinates are checked against the entire hitbox area

  • Hitbox position is relative to the current draw cursor

  • The "show" and "hide" commands affect all hitboxes globally

Last updated

Was this helpful?