# Cat Chasing Sausage (Adobe Flash Actionscript Animation)

400

3

2

## Introduction: Cat Chasing Sausage (Adobe Flash Actionscript Animation)

Hi!

In this instructable of mine I'll share with you some simple, fun codes with actionscript 2.0 to make anything follow your mouse. I'll attach the example file (.swf file) as well as the original flash file (.fla file) so you can play around with it. We need Adobe Flash any version that supports actionscript 2.0 and Flash Player version 9.0 or higher. If you have a website or blog, you can embed it onto in for fun with your own ideas and images.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 4: Copy All

setProperty("", _quality, "MEDIUM");
N = 20;

R = 12;

C = 2;

A = 2;

var x = new Array();

var y = new Array();

for (i = 0; i < N; i++)

{

x[i] = 0;

y[i] = 0;

} // end of for

for (i = 1; i < N; i++)

{

if (i == 1)

{

attachMovie("three", "Pieza" + i, N + 1 - i);

}

else if (i == 4 || i == 14)

{

attachMovie("two", "Pieza" + i, N + 1 - i);

}

else

{

attachMovie("one", "Pieza" + i, N + 1 - i);

} // end else if

this["Pieza" + i]._x = 142 + x[i - 1];

this["Pieza" + i]._y = 142 + y[i - 1];

this["Pieza" + i]._xscale = 102 + A * (1 - i);

this["Pieza" + i]._yscale = 102 + A * (1 - i);

this["Pieza" + i]._alpha = 100 - 100 / N * i;

} // end of for

## Step 5: Copy All

x = x + (_xmouse - x - 142) / R;
y = y + (_ymouse - y - 142) / R;

for (i = 1; i < N; i++)

{

x[i] = x[i] + (x[i - 1] - x[i]) / C;

y[i] = y[i] + (y[i - 1] - y[i]) / C;

} // end of for

for (i = 1; i < N; i++)

{

this["Pieza" + i]._x = 142 + (x[i - 1] + x[i]) / 2;

this["Pieza" + i]._y = 142 + (y[i - 1] + y[i]) / 2;

this["Pieza" + i]._rotation = 5.729578E+001 * Math.atan2(y[i] - y[i - 1], x[i] - x[i - 1]);

} // end of for

gotoAndPlay(2);

## Step 7: The Sausage. Done.

cursor_mc.startDrag("true");
Mouse.hide();

## Step 8: Optional. Do This If You Want to Send It to Someone.

Sorry if it's too long. Thank you for following it to the end.

## Step 9: Participated in the
Coded Creations Participated in the
Mind for Design