From 132899d222f2c7d3542655b2332ed3574ffa9737 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 5 Jul 2021 10:07:32 -0400 Subject: Added sprite opacity --- res/scripts/common.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'res/scripts/common.lua') diff --git a/res/scripts/common.lua b/res/scripts/common.lua index 1d4879f..e355a32 100644 --- a/res/scripts/common.lua +++ b/res/scripts/common.lua @@ -414,6 +414,15 @@ function SetAnimationSlowdown(spriteName, amount) sprite.animSlowdown = amount end +--- Sets the opacity of the sprite when it is rendered. +-- @param spriteName the alias of the sprite to modify +-- @param amount a value from 0.0 to 1.0 +function SetOpacity(spriteName, amount) + local spriteId = getSpriteByAlias(spriteName) + local sprite = getSprite(spriteId) + sprite.opacity = 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) -- cgit 1.4.1