Difference between revisions of "GetCursorPos"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
<b>History</b>: Available since <span style="color:green">v3.7</span>
+
<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%">
 +
<b>Command History</b>
 +
<div class="mw-collapsible-content">
 +
<div style="background:#ebebeb" width="100%">Available since <span style="color:orange">v?</span></div>
 +
</div></div>
 +
 
  
 
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 query to check if the current position is over an object/character or certain part of the scene etc.
 +
  
 
Syntax:
 
Syntax:
Line 7: Line 13:
 
getCursorPos()
 
getCursorPos()
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
Example:
 
Example:
Line 20: Line 27:
 
end
 
end
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
  

Revision as of 19:21, 7 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 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