Difference between revisions of "GetCursorPos"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 28: Line 28:
 
Return: Pos <br/>
 
Return: Pos <br/>
 
Table containing x,y values of current mouse cursor position
 
Table containing x,y values of current mouse cursor position
 +
{{i18n|GetCursorPos}}

Revision as of 17:26, 5 March 2013

History: Available since v3.7

Stores the current position (absolute) of the mouse cursor into an x,y table which can be used in query to check if the current position is over an object/character or certain part of the scene etc.

Syntax:

getCursorPos()

Example:

-- let's store the current position in a variable!
local variableName = getCursorPos()

-- let's check if the stored cursor position equals another x,y value!
if variableName.x == 200 and variableName.y == 400 then
 -- do some action!
else
 -- do some other action!
end


Arguments

Flags: none

Return: Pos
Table containing x,y values of current mouse cursor position