Using Director > Sprites > Positioning sprites > Positioning sprites with Lingo |  |

Positioning sprites with Lingo

Lingo lets you control a sprite's position by setting the sprite's coordinates on the Stage. You can also test a sprite's coordinates to determine a sprite's current position and whether two sprites overlap.

To check the location of a sprite's registration point or bounding rectangle on the Stage:

Test the `bottom`, `left`, `loc`, `locH`, `locV`, `right`, or `top` sprite property.

The `bottom`, `left`, `right`, and `top` sprite properties determine the location of the sprite's individual edges. See `bottom`, `left`, `right`, and `top`.

To place a sprite at a specific location:

Set one of the following properties:

| The `loc` sprite property sets the horizontal and vertical distance from the upper left corner of the Stage to the sprite's registration point. The value is given as a point. See `loc`.
| The `locV` sprite property sets the number of pixels from the top of the Stage to a sprite's registration point. See `locV`.
| The `locH` sprite property sets the number of pixels from the left of the Stage to a sprite's registration point. See `locH`.
| The `rect` sprite property sets the location of the sprite's bounding rectangle on the Stage. See `rect (sprite)`.
| The `quad` sprite property sets the location of the sprite's bounding rectangle on the Stage. You can specify any four points; the points do not have to form a rectangle. The `quad` property can set the sprite's coordinates as precise floating-point numbers. See `quad`.

To determine whether two sprites overlap:

Use the `sprite...intersects` operator to determine whether a sprite's bounding rectangle touches the bounding rectangle of a second sprite. Use the `sprite...within` operator to determine whether a sprite is entirely within a second sprite. See `sprite...intersects` and `sprite...within`.