Introduction: Cat Chasing Sausage (Adobe Flash Actionscript Animation)

About: Here to kill time

simple code in action script 2.0

Step 1: Short Notes

Step 2: Follow Short Notes

Step 3: Notes...

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[0] = x[0] + (_xmouse - x[0] - 142) / R;
y[0] = y[0] + (_ymouse - y[0] - 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

Step 6: Copy All. to Test, Hit Ctrl + Enter

gotoAndPlay(2);

Step 7: The Sausage. Done.

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

Step 8: Optional.

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

Step 9:

Coded Creations

Participated in the
Coded Creations

Mind for Design

Participated in the
Mind for Design