Frame 1
lastShot = 0;
bc = 1000;
onMouseDown = function () {
if ((getTimer() - lastShot) > 900) {
lastShot = getTimer();
bc++;
if (bc > 1100) {
bc = 1000;
}
duplicateMovieClip ("bullet", "b" + bc, bc);
with (_root["b" + bc]) {
spd = 10;
_x = player._x;
_y = player._y;
_rotation = _root.player._rotation;
}
}
_root["b" + bc].onEnterFrame = function () {
with (this) {
if (_rotation > 180) {
_y = _y + (spd * Math.cos((Math.PI/180) * _rotation));
_x = _x - (spd * Math.sin((Math.PI/180) * _rotation));
} else {
_y = _y - (spd * Math.cos((Math.PI/180) * _rotation));
_x = _x + (spd * Math.sin((Math.PI/180) * _rotation));
}
if ((((_x > Stage.width) || (_x < 0)) || (_y < 0)) || (_y > Stage.height)) {
this.removeMovieClip();
}
}
};
};
onMouseMove = function () {
with (player) {
this.Xd = _root._xmouse - _x;
this.Yd = _root._ymouse - _y;
radAngle = Math.atan2(Yd, Xd);
_rotation = int(((radAngle * 360) / (Math.PI*2)) + 90);
}
};
stop();
_root.score = 100;
_root.score_display.text = 100;
Instance of Symbol 5 MovieClip "player" in Frame 1
onClipEvent (load) {
speed = 9;
stop();
}
onClipEvent (enterFrame) {
if (Key.isDown(39)) {
_x = (_x + speed);
xdir = 1;
ydir = 0;
gotoAndStop (3);
} else if (Key.isDown(40)) {
_y = (_y + speed);
ydir = 1;
xdir = 0;
gotoAndStop (5);
} else if (Key.isDown(37)) {
_x = (_x - speed);
xdir = -1;
ydir = 0;
gotoAndStop (1);
} else if (Key.isDown(38)) {
_y = (_y - speed);
ydir = -1;
xdir = 0;
gotoAndStop (2);
} else if (Key.isDown(17)) {
_y = (_y - speed);
ydir = -1;
xdir = 0;
gotoAndStop (2);
}
anyHit = ((hitTest(_root.wall1) | hitTest(_root.wall2)) | hitTest(_root.wall3)) | hitTest(_root.wall4);
if (anyHit) {
_x = (_x + ((-1 * speed) * xdir));
_y = (_y + ((-1 * speed) * ydir));
}
}
onClipEvent (mouseMove) {
Xd = _root._xmouse - _x;
Yd = _root._ymouse - _y;
radAngle = Math.atan2(Yd, Xd);
_rotation = int(((radAngle * 360) / (Math.PI*2)) + 90);
updateAfterEvent();
}
Instance of Symbol 8 MovieClip in Frame 1
onClipEvent (load) {
walkSpeed = 5;
}
onClipEvent (enterFrame) {
if (Math.abs(_x - _root.player._x) <= 250) {
if (random(2)) {
if (_x < _root.player._x) {
_x = (_x + walkSpeed);
}
if (_x > _root.player._x) {
_x = (_x - walkSpeed);
}
if (_y < _root.player._y) {
_y = (_y + walkSpeed);
}
if (_y > _root.player._y) {
_y = (_y - walkSpeed);
}
}
}
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.player)) {
_root.score = _root.score - 1;
_root.score_display.text = _root.score;
}
}
Instance of Symbol 10 MovieClip in Frame 1
onClipEvent (load) {
walkSpeed = 5;
}
onClipEvent (enterFrame) {
if (Math.abs(_x - _root.player._x) <= 250) {
if (random(2)) {
if (_x < _root.player._x) {
_x = (_x + walkSpeed);
}
if (_x > _root.player._x) {
_x = (_x - walkSpeed);
}
if (_y < _root.player._y) {
_y = (_y + walkSpeed);
}
if (_y > _root.player._y) {
_y = (_y - walkSpeed);
}
}
}
}