Frame 1
stop();
Frame 2
numEnemy = 5;
i = 2;
while (i <= numEnemy) {
enemy1.duplicateMovieClip("enemy" + i, i + 100);
i++;
}
score = 0;
Instance of Symbol 10 MovieClip "mainGround" in Frame 2
onClipEvent (load) {
ground.duplicateMovieClip("ground2", 100);
ground2._x = ground._x + ground._width;
groundStartx = this._x;
groundSpeed = 10;
}
onClipEvent (enterFrame) {
if (_root.spaceship.scrollStart) {
this._x = this._x - groundSpeed;
if (this._x <= (groundStartx - ground._width)) {
this._x = groundStartx - groundSpeed;
}
}
}
Instance of Symbol 13 MovieClip "mainStars" in Frame 2
onClipEvent (load) {
stars.duplicateMovieClip("stars2", 1000);
stars2._x = stars._x + stars._width;
starsStartx = this._x;
starsSpeed = 4;
}
onClipEvent (enterFrame) {
if (_root.spaceship.scrollStart) {
this._x = this._x - starsSpeed;
if (this._x <= (starsStartx - stars._width)) {
this._x = starsStartx - starsSpeed;
}
}
}
Instance of Symbol 19 MovieClip "spaceship" in Frame 2
onClipEvent (load) {
moveSpeed = 10;
_root.laser._visible = false;
laserCounter = 1;
scrollx = _root.mainGround.ground._width / 3;
scrollStart = false;
maxLasers = 4;
depthCounter = 1;
}
onClipEvent (enterFrame) {
if (Key.isDown(17) and (laserCounter <= maxLasers)) {
laserCounter++;
_root.laser.duplicateMovieClip("laser" + depthCounter, depthCounter);
_root["laser" + depthCounter]._visible = true;
depthCounter++;
if (depthCounter > maxLasers) {
depthCounter = 1;
}
}
if (Key.isDown(39)) {
if (this._x < scrollx) {
this._x = this._x + moveSpeed;
} else {
scrollStart = true;
}
} else if (Key.isDown(37)) {
this._x = this._x - moveSpeed;
}
if (Key.isDown(40)) {
this._y = this._y + moveSpeed;
} else if (Key.isDown(38)) {
this._y = this._y - moveSpeed;
}
}
onClipEvent (keyUp) {
if (Key.getCode() == 39) {
scrollStart = false;
}
}
Instance of Symbol 21 MovieClip "laser" in Frame 2
onClipEvent (load) {
laserMoveSpeed = 20;
this._x = _root.spaceship._x + 50;
this._y = _root.spaceship._y;
}
onClipEvent (enterFrame) {
if (this._name != "laser") {
this._x = this._x + laserMoveSpeed;
if (this._x > 450) {
_root.spaceship.laserCounter--;
this.removeMovieClip();
}
i = 1;
while (i <= _root.numEnemy) {
if (this.hitTest(_root["enemy" + i])) {
_root.score = _root.score + 100;
_root["enemy" + i].gotoAndPlay(2);
}
i++;
}
}
}
Instance of Symbol 24 MovieClip "enemy1" in Frame 2
onClipEvent (load) {
function reset() {
this._x = 450;
this._y = random(100) + 50;
enemySpeed = random(4) + 1;
this.gotoAndStop(1);
}
reset();
}
onClipEvent (enterFrame) {
if (_root.spaceship.scrollStart) {
this._x = this._x - (enemySpeed + _root.mainGround.groundSpeed);
} else {
this._x = this._x - enemySpeed;
}
if (this._x < -10) {
reset();
}
if (this.hitTest(_root.spaceship)) {
_root.gotoAndStop("gameOver");
}
}
Frame 3
stop();
Symbol 7 Button
on (release) {
gotoAndPlay (2);
}
Symbol 24 MovieClip Frame 1
stop();
Symbol 24 MovieClip Frame 2
stop();
Symbol 29 Button
on (release) {
gotoAndPlay (2);
}