Lingo Dictionary > O-R > point()

 

point()

Syntax

point(horizontal, vertical)

Description

Function and data type; yields a point that has the horizontal coordinate specified by horizontal and the vertical coordinate specified by vertical.

A point has a locH and a locV property. Point coordinates can be changed by arithmetic operations.

To see an example of point() used in a completed movie, see the Imaging and Vector Shapes movies in the Learning\Lingo Examples folder inside the Director application folder.

Example

This statement sets the variable lastLocation to the point (250, 400):

set lastLocation = point(250, 400)

Example

This statement adds 5 pixels to the horizontal coordinate of the point assigned to the variable myPoint:

myPoint.locH = myPoint.locH + 5

Example

These statements set a sprite's Stage coordinates to mouseH and mouseV plus 10 pixels. The two statements are equivalent.

sprite(the clickOn).loc = point(the mouseH, the mouseV) + point(10, 10)
sprite(the clickOn).loc = the mouseLoc + 10

Example

This handler moves a named sprite to the location that the user clicks:

end mouseDown

on mouseDown
	-- Set these variables as needed for your own movie
	theSprite = 1 -- Set the sprite that should move
	steps = 40 -- Set the number of steps to get there
	initialLoc = sprite(theSprite).loc
	delta = (the clickLoc - initialLoc) / steps
	repeat with i = 1 to steps
		sprite(theSprite).loc = initialLoc + (i * delta)
		updateStage
	end repeat
end mouseDown

See also

mouseLoc, flashToStage(), rect(), stageToFlash()