diff options
Diffstat (limited to 'res/scripts/common.lua')
-rw-r--r-- | res/scripts/common.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 2a2ce35..d0ea6b5 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua | |||
@@ -542,3 +542,13 @@ function ExitAreaTransition() | |||
542 | effect():circleTransition(1, 0.0) | 542 | effect():circleTransition(1, 0.0) |
543 | Delay(1000) | 543 | Delay(1000) |
544 | end | 544 | end |
545 | |||
546 | --- Checks whether a sprite is in a zone. | ||
547 | -- @param spriteName the name of the sprite to locate | ||
548 | -- @param zoneName the name of the zone on the current map to use as a boundary | ||
549 | function IsSpriteInZone(spriteName, zoneName) | ||
550 | local pos = GetPosition(spriteName) | ||
551 | local zone = getMap():getZone(zoneName) | ||
552 | |||
553 | return (pos:x() >= zone.ul:x()) and (pos:x() <= zone.dr:x()) and (pos:y() >= zone.ul:y()) and (pos:y() <= zone.dr:y()) | ||
554 | end | ||