collision
hitbox.collision()
Returns true
if two hitboxes (areas) are overlapping.
hitbox.collision(Hitbox 1, Hitbox 2)
Hitbox 1
Array
Defines the hitbox to be used for collision detection. Can be represented in three formats:
Rectangle: [x, y, w, h]
: Where x
& y
are the top-left coordinates, w
is width and h
is height.
Polygon: [x1, y1, x2, y2, x3, y3, ...]
: A sequence of coordinates forming the polygon vertices. Must have at least three points (6 values).
Circle: [x, y, rad]: Where x
& y
are the circle's center, and rad
is its radius.
Hitbox 2
Array
Defines the hitbox to be used for collision detection. Can be represented in three formats:
Rectangle: [x, y, w, h]
: Where x
& y
are the top-left coordinates, w
is width and h
is height.
Polygon: [x1, y1, x2, y2, x3, y3, ...]
: A sequence of coordinates forming the polygon vertices. Must have at least three points (6 values).
Circle: [x, y, rad]: Where x
& y
are the circle's center, and rad
is its radius.