Bounds.contains

From MiniScript Wiki
Revision as of 16:33, 8 July 2021 by JoeStrout (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Bounds.contains returns true (1) if the given coordinates are within the bounds, and false (0) if they are outside the bounds.

Arguments

Parameter Name Type Default Value Meaning
x number 0 horizontal position; or a list or map (see below)
y number 0 vertical position

Usage Notes

The contains method may be given x and y as two separate arguments; or it may be given an [x, y] list; or it may be given any map containing "x" and "y" keys (such as mouse). If given a list or map, then the second parameter is ignored.

The coordinate system is undefined, but the parameters are assumed to be in the same coordinate system as the bounds itself. So for example, if using this with Sprite.localBounds, then x and y should be coordinates local to the sprite. But if using it with Sprite.worldBounds, then x and y should be relative to the sprite display itself.