Frame 1
if (introDone) {
gotoAndStop (2);
} else {
introDone = true;
}
stop();
Stage.showMenu = false;
version = 20031601 /* 0x131A871 */;
Frame 2
stop();
clearInterval(beatTimeout);
Key.removeListener(keyListener);
MovieClip.prototype.wrapPos = function () {
if (this._x > (xMax + (this._width / 2))) {
if (this._name == "saucer_mc") {
this.hideSaucer();
} else {
this._x = this._x - (xMax + this._width);
}
}
if (this._y > (yMax + (this._height / 2))) {
this._y = this._y - (yMax + this._height);
}
if (this._x < ((-this._width) / 2)) {
if (this._name == "saucer_mc") {
this.hideSaucer();
} else {
this._x = this._x + (xMax + this._width);
}
}
if (this._y < ((-this._height) / 2)) {
this._y = this._y + (yMax + this._height);
}
};
introMover = function () {
this._x = this._x + this.vx;
this._y = this._y + this.vy;
this.wrapPos();
};
introAsteroids = function () {
var i = 10;
while (i--) {
var angle = (Math.random() * (Math.PI*2));
var s = [100, 50, 25][i % 3];
intro_mc.attachMovie("asteroid", i, i, {vx:Math.sin(angle) * 1.5, vy:Math.cos(angle) * 1.5, _x:Math.random() * xMax, _y:Math.random() * yMax, _xscale:s, _yscale:s, onEnterFrame:introMover}).gotoAndStop((i % 4) + 1);
}
};
game_so = SharedObject.getLocal("neaveAsteroids");
score = 0;
xMax = 500;
yMax = 375;
introAsteroids();
playGame_btn.onRelease = function () {
play();
};
highScores_btn.onRelease = function () {
getURL ("http://www.neodelight.com/highscores?ref=asteroids&ref_loc=highscores&ref_ver=" + _root.version, "_blank");
};
moreGames_btn.onRelease = function () {
getURL ("http://www.neodelight.com?ref=asteroids&ref_loc=moregames&ref_ver=" + _root.version, "_blank");
};
neave_btn.onRelease = function () {
getURL ("http://www.neave.com/games/", "_blank");
};
Frame 4
stop();
spaceship_mc.gotoAndStop(1);
spaceship_mc._visible = (spaceship_mc.hit_mc._visible = (safeArea_mc._visible = (gameOver_mc._visible = (quitGame_mc._visible = (missile0_mc._visible = (missile1_mc._visible = (missile2_mc._visible = (missile3_mc._visible = (missile4_mc._visible = (saucer_mc._visible = false))))))))));
dx = (dy = (explodeNum = (asteroidNum = (scoreMod = (score = 0)))));
level = 1;
lives = 3;
friction = 0.98;
rads = (Math.PI/180);
leftKey = (rightKey = (upKey = (fireKey = (paused = (exploded = (beatToggle = false))))));
asteroids_mc.createEmptyMovieClip("explode_mc", 0);
beat1_sound = new Sound(this);
beat1_sound.attachSound("beat1");
beat2_sound = new Sound(this);
beat2_sound.attachSound("beat2");
thrust_sound = new Sound(spaceship_mc);
thrust_sound.attachSound("thrust");
saucerBig_sound = new Sound(saucer_mc);
saucerBig_sound.attachSound("saucerBig");
saucerSmall_sound = new Sound(saucer_mc);
saucerSmall_sound.attachSound("saucerSmall");
setLives = function () {
lives_mc[lives].removeMovieClip();
var i = 0;
while (i < lives) {
var _mc = lives_mc.attachMovie("spaceship", i, i, {_x:i * 15, _xscale:60, _yscale:60});
_mc.gotoAndStop(1);
_mc.hit_mc._visible = false;
i++;
}
};
setLives();
keyListener = new Object();
keyListener.onKeyDown = function () {
switch (Key.getCode()) {
case Key.LEFT :
leftKey = true;
return;
case Key.RIGHT :
rightKey = true;
return;
case Key.UP :
if (paused) {
return(undefined);
}
if (!upKey) {
thrust_sound.start(0, 1000);
}
upKey = true;
spaceship_mc.play();
return;
case Key.SPACE :
fireKey = true;
return;
case 80 :
if (!quitGame_mc._visible) {
paused = !paused;
pauseSaucer();
}
return;
case 81 :
paused = (quitGame_mc._visible = true);
return;
case 78 :
if (quitGame_mc._visible) {
paused = (quitGame_mc._visible = false);
pauseSaucer();
}
return;
case 89 :
clearInterval(hyperTimeout);
clearInterval(newShipTimeout);
clearInterval(newGameTimeout);
gotoAndStop (2);
return;
case Key.SHIFT :
if (!(spaceship_mc._visible && (!paused))) {
break;
}
spaceship_mc._visible = false;
spaceship_mc.gotoAndStop(1);
leftKey = (rightKey = (upKey = (fireKey = false)));
dx = (dy = 0);
thrust_sound.stop();
hyperTimeout = setInterval(hyperspace, 500);
}
};
keyListener.onKeyUp = function () {
switch (Key.getCode()) {
case Key.LEFT :
leftKey = false;
return;
case Key.RIGHT :
rightKey = false;
return;
case Key.UP :
upKey = false;
thrust_sound.stop();
spaceship_mc.gotoAndStop(1);
return;
case Key.SPACE :
fireKey = false;
}
};
spaceship_mc.onEnterFrame = function () {
if (paused || (!this._visible)) {
return(undefined);
}
if (leftKey) {
this._rotation = this._rotation - 10;
}
if (rightKey) {
this._rotation = this._rotation + 10;
}
var vx = Math.sin(this._rotation * rads);
var vy = (-Math.cos(this._rotation * rads));
if (upKey) {
dx = dx + (vx / 4);
dy = dy + (vy / 4);
}
dx = dx * friction;
dy = dy * friction;
this._x = this._x + dx;
this._y = this._y + dy;
this.wrapPos();
if (fireKey) {
fireKey = false;
var i = 4;
var num = -1;
while (i--) {
if (!_root[("missile" + i) + "_mc"]._visible) {
num = i;
break;
}
}
if (num != -1) {
var _mc = _root[("missile" + num) + "_mc"];
_mc.fuse = 24;
_mc.vx = (vx * 10) + dx;
_mc.vy = (vy * 10) + dy;
_mc._x = this._x + (vx * 10);
_mc._y = this._y + (vy * 10);
_mc._visible = true;
_mc.onEnterFrame = missileMover;
sound_mc.gotoAndPlay("fire");
}
}
var s = int(score / 10000);
if (scoreMod != s) {
scoreMod = s;
lives++;
setLives();
sound_mc.gotoAndPlay("extra");
}
if (((missile4_mc.hitTest(this.hit_mc) && (!exploded)) && (this._visible)) && (missile4_mc._visible)) {
missile4_mc._visible = false;
exploded = true;
explodeSpaceship();
}
};
saucer_mc.hideSaucer = function () {
saucerBig_sound.stop();
saucerSmall_sound.stop();
this._visible = false;
delete this.onEnterFrame;
};
pauseSaucer = function () {
if (saucer_mc._visible) {
if (paused) {
saucerBig_sound.stop();
saucerSmall_sound.stop();
} else if (saucer_mc.small) {
saucerSmall_sound.start(0, 80);
} else {
saucerBig_sound.start(0, 80);
}
}
};
explodeSaucer = function () {
saucer_mc.hideSaucer();
var i = 12;
while (i--) {
var angle = (Math.random() * (Math.PI*2));
var vx = (Math.sin(angle) * 2);
var vy = (Math.cos(angle) * 2);
asteroids_mc.explode_mc.attachMovie("explosion", explodeNum, explodeNum, {vx:vx, vy:vy, fuse:Math.ceil(Math.random() * 40), _x:((vx * Math.random()) * 4) + saucer_mc._x, _y:((vy * Math.random()) * 4) + saucer_mc._y, onEnterFrame:explodeMover});
explodeNum++;
}
sound_mc.gotoAndPlay("bangMedium");
};
explodeSpaceship = function () {
spaceship_mc._visible = false;
explode_mc._x = spaceship_mc._x;
explode_mc._y = spaceship_mc._y;
lives--;
setLives();
var i = 40;
while (i--) {
var _mc = explode_mc.createEmptyMovieClip(i, i);
_mc.vx = (Math.sin(Math.random() * (Math.PI*2)) * Math.random()) * 5;
_mc.vy = (Math.cos(Math.random() * (Math.PI*2)) * Math.random()) * 5;
_mc.fuse = Math.ceil(Math.random() * 30) + 10;
_mc._x = (Math.random() * 12) - 6;
_mc._y = (Math.random() * 12) - 6;
_mc._rotation = Math.random() * 360;
_mc.lineStyle(Math.random() * 2, random(16777215));
var len = (Math.random() * 4);
_mc.moveTo(0, len * -1);
_mc.lineTo(0, len);
_mc.onEnterFrame = explodeMover;
}
if (lives > 0) {
newShipTimeout = setInterval(newSpaceship, 1500);
} else {
gameOver_mc.gotoAndPlay(2);
gameOver_mc._visible = true;
quitGame_mc._visible = false;
Key.removeListener(keyListener);
clearInterval(hyperTimeout);
clearInterval(newShipTimeout);
clearInterval(newGameTimeout);
thrust_sound.stop();
saucerBig_sound.stop();
saucerSmall_sound.stop();
}
sound_mc.gotoAndPlay("bangMedium");
};
explodeMover = function () {
if (paused) {
return(undefined);
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
this.fuse--;
if (this.fuse < 0) {
this.removeMovieClip();
}
};
missileMover = function () {
if (paused) {
return(undefined);
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
this.wrapPos();
this.fuse--;
if (this.fuse == 0) {
this._visible = false;
delete this.onEnterFrame;
}
};
saucerMover = function () {
if (paused) {
return(undefined);
}
this._x = this._x + this.vx;
if (Math.random() < 0.02) {
this.vy = (int(Math.random() * 3) - 1) * 2;
}
if (this.vy != 0) {
this._y = this._y + this.vy;
}
this.wrapPos();
var i = 4;
while (i--) {
var _mc = _root[("missile" + i) + "_mc"];
if (_mc._visible) {
if (_mc.hitTest(this)) {
_mc._visible = false;
explodeSaucer();
if (this.small) {
score = score + 1000;
} else {
score = score + 200;
}
}
}
}
var _mc = missile4_mc;
if ((!_mc._visible) && (Math.random() < 0.1)) {
var angle = ((this.small && (spaceship_mc._visible)) ? (Math.atan2(((spaceship_mc._x - this._x) + (Math.random() * 64)) - 32, ((this._y - spaceship_mc._y) + (Math.random() * 64)) - 32)) : (Math.random() * (Math.PI*2)));
_mc.fuse = 24;
_mc.vx = Math.sin(angle) * 8;
_mc.vy = Math.cos(angle) * -8;
_mc._x = this._x + _mc.vx;
_mc._y = this._y + (_mc.vy * 2);
_mc._visible = true;
_mc.onEnterFrame = missileMover;
sound_mc.gotoAndPlay("fire");
}
if ((spaceship_mc.hit_mc.hitTest(this) && (!exploded)) && (spaceship_mc._visible)) {
exploded = true;
explodeSpaceship();
}
};
asteroidMover = function () {
if (paused) {
return(undefined);
}
this._x = this._x + this.vx;
this._y = this._y + this.vy;
this.wrapPos();
var asteroidHit = false;
var spaceshipShot = false;
if (saucer_mc._visible && (saucer_mc.hitTest(this))) {
asteroidHit = true;
explodeSaucer();
}
if ((spaceship_mc.hit_mc.hitTest(this) && (!exploded)) && (spaceship_mc._visible)) {
exploded = (asteroidHit = (spaceshipShot = true));
explodeSpaceship();
}
var i = 5;
while (i--) {
var _mc = _root[("missile" + i) + "_mc"];
if (_mc._visible && (_mc.hitTest(this))) {
_mc._visible = false;
asteroidHit = true;
if (i < 4) {
spaceshipShot = true;
}
break;
}
}
if (asteroidHit) {
var s = ((this._xscale = (this._yscale = this._yscale / 2)));
var angle = (Math.random() * (Math.PI*2));
this.vx = this.vx + Math.sin(angle);
this.vy = this.vy + Math.cos(angle);
asteroidCount--;
var j = (int(s / 25) + 4);
while (j--) {
var angle = (Math.random() * (Math.PI*2));
var vx = (Math.sin(angle) * 2);
var vy = (Math.cos(angle) * 2);
asteroids_mc.explode_mc.attachMovie("explosion", explodeNum, explodeNum, {vx:vx, vy:vy, fuse:Math.ceil(Math.random() * s), _x:((vx * Math.random()) * 4) + this._x, _y:((vy * Math.random()) * 4) + this._y, onEnterFrame:explodeMover});
explodeNum++;
}
if (s < 25) {
this.removeMovieClip();
sound_mc.gotoAndPlay("bangSmall");
if (spaceshipShot) {
score = score + 100;
}
} else {
if (s == 50) {
sound_mc.gotoAndPlay("bangLarge");
if (spaceshipShot) {
score = score + 20;
}
} else {
sound_mc.gotoAndPlay("bangMedium");
if (spaceshipShot) {
score = score + 50;
}
}
this.gotoAndStop((i % 4) + 1);
var angle = (Math.random() * (Math.PI*2));
makeAsteroid(this._x, this._y, this.vx + Math.sin(angle), this.vy + Math.cos(angle), s);
}
}
};
makeAsteroid = function (x, y, vx, vy, s) {
asteroidNum++;
var _mc = asteroids_mc.attachMovie("asteroid", asteroidNum, asteroidNum, {vx:vx, vy:vy, _x:x, _y:y, _xscale:s, _yscale:s, onEnterFrame:asteroidMover});
_mc.gotoAndStop((asteroidNum % 4) + 1);
return(_mc);
};
hyperspace = function () {
if (paused) {
return(undefined);
}
with (spaceship_mc) {
_visible = true;
_x = (Math.random() * (xMax - (_width * 2))) + _width;
_y = (Math.random() * (yMax - (_height * 2))) + _height;
}
clearInterval(hyperTimeout);
};
beatSound = function () {
if (paused) {
return(undefined);
}
beatToggle = !beatToggle;
if (beatToggle) {
beat1_sound.start();
} else {
beat2_sound.start();
}
if (gameOver_mc._visible) {
return(undefined);
}
if (beatCount > 300) {
beatCount = beatCount - 10;
clearInterval(beatTimeout);
beatTimeout = setInterval(beatSound, beatCount);
}
if (((beatCount < 700) && (!saucer_mc._visible)) && (Math.random() < 0.05)) {
if ((beatCount < 400) && (Math.random() < 0.4)) {
saucer_mc._xscale = (saucer_mc._yscale = 50);
saucer_mc.small = true;
saucerSmall_sound.start(0, 100);
} else {
saucer_mc._xscale = (saucer_mc._yscale = 100);
saucer_mc.small = false;
saucerBig_sound.start(0, 100);
}
if (Math.random() < 0.5) {
saucer_mc.vx = -2;
saucer_mc._x = (saucer_mc._width / 2) + xMax;
} else {
saucer_mc.vx = 2;
saucer_mc._x = saucer_mc._width / -2;
}
saucer_mc.vy = 0;
saucer_mc._y = Math.random() * yMax;
saucer_mc._visible = true;
saucer_mc.onEnterFrame = saucerMover;
}
if ((asteroidCount == 0) && (!saucer_mc._visible)) {
clearInterval(beatTimeout);
level++;
newGameTimeout = setInterval(newGame, 1000);
}
};
newSpaceship = function () {
spaceship_mc._x = 250;
spaceship_mc._y = 190;
spaceship_mc._rotation = 0;
var asteroidHit = false;
for (var i in asteroids_mc) {
if (spaceship_mc.hitTest(asteroids_mc[i])) {
asteroidHit = true;
break;
}
}
if (!asteroidHit) {
spaceship_mc._visible = true;
exploded = false;
dx = (dy = 0);
clearInterval(newShipTimeout);
}
};
newGame = function () {
var i = ((level < 7) ? (level + 3) : 10);
asteroidCount = i * 7;
while (i--) {
var angle = (Math.random() * (Math.PI*2));
var _mc = makeAsteroid(Math.random() * xMax, Math.random() * yMax, Math.sin(angle) * 1.5, Math.cos(angle) * 1.5, 100);
if (_mc.hitTest(spaceship_mc) || (_mc.hitTest(safeArea_mc))) {
i++;
asteroidNum--;
}
}
beatCount = ((level < 7) ? (1100 - (level * 100)) : 400);
beatSound();
Key.addListener(keyListener);
clearInterval(newGameTimeout);
};
newGameTimeout = setInterval(newGame, 1000);
newShipTimeout = setInterval(newSpaceship, 1100);
Symbol 16 Button
on (release) {
getURL (("http://www.neodelight.com?ref=" + _root.game) + "&ref_loc=intro", "_BLANK");
}
Symbol 27 MovieClip Frame 1
startFrame = _parent._currentframe;
Symbol 27 MovieClip Frame 2
vol = (1 - ((_parent._currentFrame - startFrame) / (_parent._totalFrames - startFrame))) * 100;
if (vol < 0) {
vol = 0;
}
_parent.snd.setVolume(vol);
Symbol 27 MovieClip Frame 3
gotoAndPlay (2);
Symbol 28 MovieClip Frame 1
snd = new Sound(this);
snd.setVolume(100);
_parent.stop();
Symbol 28 MovieClip Frame 123
stop();
_parent.play();
Symbol 32 MovieClip Frame 1
_global.api = new Object();
_global.api.debug = new Object();
_global.api.highscore = new Object();
_global.api.debug.describe = function (o) {
var d = (("[DESCRIBE: " + o.toString()) + "]");
d = d + "\n---------------------------DESC-START";
for (var i in o) {
d = d + (((newline + i) + ": ") + o[i]);
}
d = d + "\n---------------------------DESC-STOP";
return(d);
};
_global.api.snd = new Object();
_global.api.snd.lib = new Object();
_global.api.snd.load = function (name, url) {
var s = new Sound();
if (url eq "") {
s.attachSound(name);
} else {
s.loadSound(url);
}
_global.api.snd.lib[name] = s;
};
_global.api.snd.play = function (name) {
_root.snd[name].gotoAndPlay(1);
};
_global.api.highscore.initSession = function () {
this.session = "";
while (this.session.length < 20) {
this.session = this.session + this.charTable.charAt(Math.round(Math.random() * (this.charTable.length - 4)));
}
this.charTableIndex = new Array();
var i = 0;
while (i < this.charTable.length) {
this.charTableIndex[this.charTable.charCodeAt(i)] = i;
i++;
}
};
_global.api.highscore.submit = function (pGame, pDisciple, pScore0, pScore1) {
trace("score: " + pScore0);
var s = (("g=" + pGame) + "&");
s = s + (("d=" + pDisciple) + "&");
s = s + (("s0=" + pScore0) + "&");
s = s + (("s1=" + pScore1) + "&");
s = s + ("se=" + escape(session));
s = s + "&c=42";
var urlSubmit = ((this.urlSubmit + "?s=") + escape(this.encrypt(this.encrypt(s, this.keystring), this.keystring2)).split("%").join("_"));
trace(urlSubmit);
getURL (urlSubmit, "_blank");
};
_global.api.highscore.encrypt = function (text, pKey) {
var crypt = "";
var checkSum = 0;
var shift;
var code;
var i = 0;
while (i < text.length) {
char = this.charTableIndex[text.charCodeAt(i)];
shift = this.charTableIndex[pKey.charCodeAt(i % pKey.length)];
code = (char + shift) + checkSum;
code = code % this.charTable.length;
crypt = crypt + this.charTable.charAt(code);
checkSum = checkSum + code;
i++;
}
checkSum = checkSum % this.charTable.length;
return((crypt + "") + this.charTable.charAt(checkSum));
};
_global.api.highscore.charTable = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&=.";
_global.api.highscore.keystring = "whytheheckdoyouwasteyourtimehackingthishighscorelist";
_global.api.highscore.keystring2 = "AnotherKey4You2FindOut4815jiagIOm30JK";
_global.api.highscore.urlSubmit = "http://www.neodelight.com/v4/high_enter.php";
_global.api.highscore.initSession();
_visible = false;
Symbol 60 MovieClip Frame 1
stop();
Symbol 60 MovieClip Frame 3
stop();
Symbol 60 MovieClip Frame 5
stop();
Symbol 60 MovieClip Frame 7
stop();
Symbol 60 MovieClip Frame 9
stop();
Symbol 60 MovieClip Frame 11
stop();
Symbol 65 Button
on (release, keyPress "y") {
_global.api.highscore.submit("asteroids", "", _level0.score, 0);
}
Symbol 69 Button
on (release, keyPress "n") {
_root.gotoAndStop(2);
}
Symbol 71 MovieClip Frame 1
stop();
Symbol 71 MovieClip Frame 60
Symbol 71 MovieClip Frame 61
stop();
name_txt.restrict = "A-Z 0-9.\\-";
if (_root.game_so.data.playerName.length > 0) {
name_txt.text = _root.game_so.data.playerName;
}
Selection.setFocus(name_txt);
Selection.setSelection(name_txt.length, name_txt.length);