From 065d5dbac17664666d6a83583141d4cdf0bb691c Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 12 Mar 2021 16:41:25 -0500 Subject: Interacting with Kuma and Duster in the finale The hot spring is also a little bigger now, because I'm using an enclosure to keep Lucas in, instead of setting the tiles to being solid or not. #20 --- res/scripts/common.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'res/scripts/common.lua') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index dbc021c..1d4879f 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -414,6 +414,14 @@ function SetAnimationSlowdown(spriteName, amount) sprite.animSlowdown = amount end +--- Sets the enclosure zone for a sprite. +-- The sprite will be prevented from exiting the area defined by that zone. +function AddEnclosureZone(spriteName, zone) + local spriteId = getSpriteByAlias(spriteName) + local sprite = getSprite(spriteId) + sprite.enclosureZone = zone +end + --- Removes the enclosure zone for the specified sprite. -- This allows the sprite to move outside of the confines of the zone. function RemoveEnclosureZone(spriteName) @@ -607,3 +615,10 @@ function IsSpriteInZone(spriteName, 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 + +--- Sets the name of the script on the current map that will be executed when the player interacts with this sprite. +function SetInteractionScript(spriteName, scriptName) + local spriteId = getSpriteByAlias(spriteName) + local sprite = getSprite(spriteId) + sprite.interactionScript = scriptName +end -- cgit 1.4.1