home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 112
/
jogo-disk-112.iso
/
Games
/
parking_zone.swf
/
scripts
/
DefineSprite_89
/
frame_1
/
DoAction.as
Wrap
Text File
|
2010-07-14
|
825b
|
30 lines
function rotateCarToFree()
{
yDistance = _root["parking" + _root.freeParking]._y - this._y;
xDistance = _root["parking" + _root.freeParking]._x - this._x;
targetAngle = Math.atan2(yDistance,xDistance) * 180 / 3.141592653589793;
rotator.onEnterFrame = function()
{
deltaAngle = targetAngle - _rotation;
if(Math.abs(deltaAngle) > 10)
{
if(deltaAngle > 0 and deltaAngle < 180 or deltaAngle > -360 and deltaAngle < -180)
{
_rotation = _rotation + 10;
}
else
{
_rotation = _rotation - 10;
}
}
else
{
_rotation = targetAngle;
_root.carStoppedRotating();
delete this.onEnterFrame;
}
};
}
stop();
this.createEmptyMovieClip("rotator",100);