// new module script
DynamicSprite *echosprite;
DynamicSprite *echosprite2;
DynamicSprite *echomask;
int angle = 1;
int echoX;
int echoY;
int echotimer=0;
bool doEcho = false;
int size;
static function VFX::EchoAt (int x, int y,int radius)
{
echoX = x;
echoY = y;
echotimer = 0;
doEcho = true;
size = radius*2;
echosprite = DynamicSprite.Create (radius*2, radius*2);
echosprite2 = DynamicSprite.CreateFromExistingSprite (echosprite.Graphic);
sldEcho.Min = 0;
sldEcho.Max = radius;
sldEcho.Value = 0;
sldEcho.TweenValue (1.0, radius, eEaseLinearTween, eNoBlockTween);
sldEcho2.Min = 0;
sldEcho2.Max = radius;
sldEcho2.Value = 0;
sldEcho2.TweenValue (1.2, radius, eEaseInOutSineTween, eNoBlockTween);
}
function MakeEcho ()
{
if (echotimer < size && doEcho)
{
echomask = DynamicSprite.Create (size, size);
DrawingSurface *surf = echomask.GetDrawingSurface ();
surf.DrawingColor = 15;
surf.DrawCircle (size/2, size/2, sldEcho.Value);
surf.DrawingColor = 0;
surf.DrawCircle (size/2, size/2, sldEcho2.Value);
surf.Release ();
echosprite2 = DynamicSprite.CreateFromExistingSprite (echosprite.Graphic);
echosprite = DynamicSprite.CreateFromScreenShot (320, 200);
int newX = echoX-(size/2);
int w=newX+size;
int underflowX;
int overflowX;
int newY = echoY-(size/2);
int h = newY+size;
int underflowY;
int overflowY;
if (newX < 0)
{
underflowX = newX * (-1);
newX = 0;
}
if (newX+size > 320)
{
overflowX = (newX+size-320);
w = 320-overflowX;
}
{
}
if (newY < 0)
{
underflowY = newY * (-1);
newY = 0;
}
if (newY+size > 200)
{
overflowY = (newY+size-200);
h = 200-overflowY;
}
if (w+newX > echosprite.Width)
{
newX = 0;
w = echosprite.Width;
}
if (h+newY > echosprite.Height)
{
newY = 0;
h = echosprite.Height;
}
echosprite.Crop (newX, newY, w, h);
echosprite.ChangeCanvasSize (size, size, overflowX-underflowX, overflowY-underflowY);
echosprite.CopyTransparencyMask (echomask.Graphic);
Translucence.CreateOverlay (80, echosprite.Graphic, 128, 2, echoX-(size/2)-1-Random(1), echoY-(size/2)+1-Random(1)); //You can replace this with drawing at 50% transparency.
//Translucence.CreateOverlay (81, echomask.Graphic, 128-echotimer, 2, echoX-(size/2), echoY-size/2);
echotimer = sldEcho.Value;
}
else
{
echotimer = 0;
echoX = 0;
echoY = 0;
doEcho = false;
Translucence.DeleteOverlay (80);
Translucence.DeleteOverlay (81);
}
}