IsInsideRadarArea: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Flagged broken function) |
||
Line 1: | Line 1: | ||
{{Needs_Checking| | |||
''isInsideRadarArea()'' does not work correctly.<br> | |||
Use something like this instead: | |||
<syntaxhighlight lang="lua"> | |||
function isReallyInsideRadarArea ( theArea, x, y ) | |||
local posX, posY = getElementPosition ( theArea ) | |||
local sizeX, sizeY = getRadarAreaSize ( theArea ) | |||
return (x >= posX) and (x <= posX + sizeX) and (y >= posY) and (y <= posY + sizeY) | |||
end | |||
isInsideRadarArea = nil | |||
</syntaxhighlight> | |||
}} | |||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} |
Revision as of 00:19, 5 December 2009
This article needs checking. | |
Reason(s): isInsideRadarArea() does not work correctly. function isReallyInsideRadarArea ( theArea, x, y ) local posX, posY = getElementPosition ( theArea ) local sizeX, sizeY = getRadarAreaSize ( theArea ) return (x >= posX) and (x <= posX + sizeX) and (y >= posY) and (y <= posY + sizeY) end isInsideRadarArea = nil |
This function checks if a 2D position is inside a radararea or not.
Syntax
bool isInsideRadarArea ( radararea theArea, float posX, float posY )
Required Arguments
- theArea: The radar area you're checking the position against.
- posX: The X coordinate of the position you're checking.
- posY: The Y coordinate of the position you're checking.
Returns
Returns true if the position is inside the radar area, false if it isn't or if any parameters are invalid.
Example
This function checks if an element is within a radar area.
function isElementInsideRadarArea ( theElement, theArea ) -- get the x, y coordinates from getElementPosition (z gets silently discarded) local posX, posY = getElementPosition( theElement ) -- call isInsideRadarArea with those coordinates and return its result return isInsideRadarArea ( theArea, posX, posY ) end
See Also
- createRadarArea
- getRadarAreaColor
- getRadarAreaSize
- isInsideRadarArea
- isRadarAreaFlashing
- setRadarAreaColor
- setRadarAreaFlashing
- setRadarAreaSize