boundsOffunctionnacatamalon
boundsOf(thing: TMeasurable) => { x, y, width, height }Where it sits and how big it is: the rectangle it covers, x and y its top-left corner, with its
anchor, its pivot and its own scale taken into account.
In the same place its transform is written, the box it hangs from, and not the world: two things
of one box line up with it whatever the box is doing, which is what laying out a HUD or a menu
needs. Unturned: a turned thing gives the rectangle it would cover straight.
Parámetros
thingTMeasurableA sprite, a text or a panel.
Ejemplo
declare const score: TText;
declare const coin: TSprite;
// The coin just after the score, however long the score has grown.
const at = boundsOf(score);
coin.transform.x = at.x + at.width + 4;