22.11.2ooo

Objekt richtet sich nach der Mouse

>kommentieren?<

  Das war keine leichte Geburt...

gotoAndPlay (1);
mouseposx = _xmouse;
mouseposy = _ymouse;
objectposx = square._x;
objectposy = square._y;
quadrant = ( Math.abs(mouseposx-objectposx) / Math.abs(mouseposy-objectposy) );
aenderneins = Math.atan(quadrant)*Number(180)/Math.PI;
aendernzwei = -(Math.atan(quadrant)*Number(180)/Math.PI)+180;
aenderndrei = (Math.atan(quadrant)*Number(180)/Math.PI)+180;
aendernvier = -(Math.atan(quadrant)*Number(180)/Math.PI)+360;
if(Number(mouseposx)>objectposx and Number(mouseposy)<=objectposy) {
setProperty ("square", _rotation, aenderneins);
} else if (Number(mouseposx)>objectposx and Number(mouseposy)>objectposy) {
setProperty ("square", _rotation, aendernzwei);
} else if (Number(mouseposx)<=objectposx and Number(mouseposy)>objectposy) {
setProperty ("square", _rotation, aenderndrei);
} else if (Number(mouseposx)<=objectposx and Number(mouseposy)<=objectposy) {
setProperty ("square", _rotation, aendernvier);
} else {
setProperty ("square", _rotation, 0);
}