From 6dab458c5fcd97aca871b46a43a2b46c80d1ed3c Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 6 Mar 2021 23:41:40 -0500 Subject: Idling in front of the mirror faces you toward it --- res/scripts/common.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'res/scripts/common.lua') 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() effect():circleTransition(1, 0.0) Delay(1000) end + +--- Checks whether a sprite is in a zone. +-- @param spriteName the name of the sprite to locate +-- @param zoneName the name of the zone on the current map to use as a boundary +function IsSpriteInZone(spriteName, zoneName) + local pos = GetPosition(spriteName) + local zone = getMap():getZone(zoneName) + + return (pos:x() >= zone.ul:x()) and (pos:x() <= zone.dr:x()) and (pos:y() >= zone.ul:y()) and (pos:y() <= zone.dr:y()) +end -- cgit 1.4.1