Difference between revisions of "GetCursorPos"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 6: Line 6:
  
  
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.
+
Stores the current position (absolute) of the mouse cursor into an x,y table, which can be used in a query to check if the current position is over an object/character or a certain part of the scene etc.
  
  
Line 32: Line 32:
 
<b><u>Arguments</u></b>
 
<b><u>Arguments</u></b>
  
Flags: none
+
none
  
Return: Pos <br/>
+
 
 +
<b><u>Flags</u></b>
 +
 
 +
none
 +
 
 +
 
 +
<b><u>Return</u></b>
 +
 
 +
<b>pos</b> <br/>
 
Table containing x,y values of current mouse cursor position
 
Table containing x,y values of current mouse cursor position
{{i18n|GetCursorPos}}
+
{{i18n|GetCursorPos}} <br/>
 +
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
 +
|-
 +
|<b>Relevant Pages</b>: [[SetCurorPos|setCursorPos]]
 +
|}

Revision as of 16:35, 12 March 2013

Command History

Available since v?


Stores the current position (absolute) of the mouse cursor into an x,y table, which can be used in a query to check if the current position is over an object/character or a 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

none


Flags

none


Return

pos
Table containing x,y values of current mouse cursor position


Relevant Pages: setCursorPos