Meh not my best. I just thought of the idea in science class one day (for no reason) and i wrote the code in class and finished it up when i got home.
i know theres probably a lot of unnecessary code but im rusty in scripting cause ive been on a break from it for a while.
i hope you enjoy for some reason.
x = random(5)+3;
y = random(5)+3
x2 = random(5)+3;
y2 = random(5)+3;
line1x = 0;
line1y = 400;
line2x = 550;
line2y = 400;
i = 10;
myFill=Math.random()*0xFFFFFF
linethickness = 13;
emptylinespeed = 4;
linestat = "unset";
createEmptyMovieClip("shape", 0);
createEmptyMovieClip("line1", 1);
createEmptyMovieClip("line2", 2);
cut = function (target:String) {
if (target == "line1") {
createEmptyMovieClip("emptyline", 3);
emptyline.lineStyle(linethickness, 0xFF0000, 100);
emptyline.moveTo(line1x, line1y);
emptyline.lineTo(linex, liney);
} else {
createEmptyMovieClip("emptyline", 3);
emptyline.lineStyle(linethickness, 0xFF0000, 100);
emptyline.moveTo(line2x, line2y);
emptyline.lineTo(linex, liney);
}
};
onEnterFrame = function () {
if (linestat == "set") {
emptyline._y -= emptylinespeed;
emptylinespeed -= .5;
emptyline._alpha -= 2;
line1.clear();
line2.clear();
with (shape) {
clear();
lineStyle(_root.linethickness, 0x000000, 100);
beginFill(myFill, 100);
moveTo(0, 400);
lineTo(550, 400);
lineTo(linex, liney);
lineTo(0, 400);
}
} else {
with (line1) {
clear();
lineStyle(_root.linethickness, 0x000000, 100);
moveTo(0, 400);
lineTo(line1x, line1y);
}
with (line2) {
clear();
lineStyle(_root.linethickness, 0x000000, 100);
moveTo(550, 400);
lineTo(line2x, line2y);
}
line1x += x;
line1y -= y;
line2x -= x2;
line2y -= y2;
if (line1.hitTest(line2x, line2y, true)) {
linex = line2x;
liney = line2y;
linestat = "set";
_root.cut("line1");
} else if (line2.hitTest(line1x, line1y, true)) {
linex = line1x;
liney = line1y;
linestat = "set";
_root.cut("line2");
} else if (line1x == line2x && line1y == line2y) {
linex = line1x;
liney = line1y;
linestat = "set";
}
}
};
http://img220.imageshack.us/my.php?image=triangledrawermt1.swf