Instance of Symbol 2 MovieClip in Frame 1
onClipEvent (load) {
xSpeed = 0;
ySpeed = 0;
acceleration = 0.2;
maxSpeed = 10;
friction = 0.985;
}
onClipEvent (enterFrame) {
velocity = Math.sqrt(Math.pow(xSpeed, 2) + Math.pow(ySpeed, 2));
if (Key.isDown(38)) {
ySpeed = ySpeed - 0.25;
}
if (Key.isDown(40)) {
ySpeed = ySpeed + 0.25;
}
if (Key.isDown(37)) {
xSpeed = xSpeed - 0.25;
}
if (Key.isDown(39)) {
xSpeed = xSpeed + 0.25;
}
if (_x < 0) {
_x = 775;
}
if ((_x + _width) > 800) {
_x = 0;
}
if (_y < 0) {
_y = 575;
}
if ((_y + _height) > 600) {
_y = 0;
}
_x = (_x + xSpeed);
_y = (_y + ySpeed);
if (xSpeed > maxSpeed) {
xSpeed = maxSpeed;
}
if (xSpeed < (-maxSpeed)) {
xSpeed = -maxSpeed;
}
if (ySpeed > maxSpeed) {
ySpeed = maxSpeed;
}
if (ySpeed < (-maxSpeed)) {
ySpeed = -maxSpeed;
}
xSpeed = xSpeed * friction;
ySpeed = ySpeed * friction;
}