Frame 1
function GlobalParent() {
this._state = "Loading";
this.Max_x = 480;
this.Max_y = 480;
this.Score = 0;
this.HighScore = 0;
this._theme = 1;
this._level = 1;
this.Depth_Count = 0;
this.Object_Count = 0;
this.ActiveObjects = 0;
this.ExplosionScale = 100;
this.PiCalculation = (Math.PI/180);
this._radius = 15;
this._orbitrotation = 0;
this._orbitspeed = 5;
this.ActiveOrbs = 0;
this.ActiveOrbiters = 0;
this.MaxOrbs = 10;
this.EvolveCount = 10;
this.EvolveFlag = 1;
this._initTime = 0;
this._finalTime = 0;
this._bestTime = 0;
this._orbitersPerLevel = 10;
this._orbiterSpacing = 30;
this._evolve = false;
this.SphereScale = 75;
}
function SpriteParent(id, instanceName) {
Global.Sprite_Count++;
this._id = int(id);
this._spriteid = int(Global.Sprite_Count);
this._state = "Inactive";
this._color = 0;
this._type = 0;
this._xpos = 0;
this._ypos = 0;
this._xs = 0;
this._ys = 0;
this._targetx = 0;
this._targety = 0;
this._scale = 100;
this._rotation = 0;
this._speed = 5;
this._xslot = 0;
this.JumpCounter = 0;
this._shakecounter = 0;
this._bumpcounter = 0;
this._counter = 0;
this._radius = 0;
this._orbitrotation = 0;
this._orbitslot = 0;
this._instance = instanceName;
this._scalestep = 2;
}
function GetDistance(Datastruct_1, Datastruct_2) {
xdist = Datastruct_1._xpos - Datastruct_2._xpos;
ydist = Datastruct_1._ypos - Datastruct_2._ypos;
return(Math.sqrt((xdist * xdist) + (ydist * ydist)));
}
function move_orbitron(Datastruct) {
Datastruct._xpos = _root._xmouse;
Datastruct._ypos = _root._ymouse;
}
function rotate_object(Datastruct) {
Datastruct._rotation = Datastruct._rotation + Datastruct._rotatespeed;
}
function set_angle(Datastruct) {
if (Datastruct._target_id > 0) {
Datastruct._targetx = _root["ObjectInfo_" + Datastruct._target_id]._xpos;
Datastruct._targety = _root["ObjectInfo_" + Datastruct._target_id]._ypos;
} else {
Datastruct._targetx = random(Global.Max_x);
Datastruct._targety = Global.Max_y + 200;
}
xdiff = Math.abs(Datastruct._xpos - Datastruct._targetx);
ydiff = Math.abs(Datastruct._ypos - Datastruct._targety);
x_frames = xdiff / Datastruct._speed;
y_frames = ydiff / Datastruct._speed;
if (x_frames > y_frames) {
Max_Frames = x_frames;
} else {
Max_Frames = y_frames;
}
Datastruct._xs = xdiff / Max_Frames;
Datastruct._ys = ydiff / Max_Frames;
if (Datastruct._xpos > Datastruct._targetx) {
Datastruct._xs = -Datastruct._xs;
}
if (Datastruct._ypos > Datastruct._targety) {
Datastruct._ys = -Datastruct._ys;
}
}
function move_orbiter(Datastruct) {
switch (Datastruct._state) {
case "Active" :
Datastruct._scale = Datastruct._scale + Datastruct._scalestep;
if ((Datastruct._scale > 100) || (Datastruct._scale < 30)) {
Datastruct._scalestep = -Datastruct._scalestep;
}
MC_scale(_root["Orbiter_" + Datastruct._id], Datastruct._scale);
return;
case "Dropping" :
Datastruct._ypos = Datastruct._ypos + Datastruct._speed;
return;
case "Floating" :
float_MovieClip(Datastruct);
return;
case "Evade" :
evade_orbitron(Datastruct);
return;
case "Orbiting" :
Datastruct._scale = Datastruct._scale + Datastruct._scalestep;
if ((Datastruct._scale >= 25) && (Datastruct._scale <= 35)) {
Datastruct._scalestep = 30;
Datastruct._scalestep = 0;
}
if ((Datastruct._scale > 100) || (Datastruct._scale < 30)) {
Datastruct._scalestep = -Datastruct._scalestep;
}
if (Datastruct._radius < Global._radius) {
Datastruct._radius = Datastruct._radius + 3;
}
Datastruct._orbitrotation = Global._orbitrotation + (Datastruct._orbitslot * 36);
Datastruct._xpos = OrbitronInfo_1._xpos + (Datastruct._radius * Math.cos(Datastruct._orbitrotation * _root.Global.PiCalculation));
Datastruct._ypos = OrbitronInfo_1._ypos + (Datastruct._radius * Math.sin(Datastruct._orbitrotation * _root.Global.PiCalculation));
MC_scale(_root["Orbiter_" + Datastruct._id], Datastruct._scale);
_root["Orbiter_" + Datastruct._id].filters = [glow];
return;
case "Shooting" :
with (Datastruct) {
_xpos = _xpos + _xs;
_ypos = _ypos + _ys;
if ((((_xpos > Global.Max_x) || (_xpos < 0)) || (_ypos > Global.Max_y)) || (_ypos < 0)) {
MC_hide("Orbiter_" + _id);
_state = "Inactive";
}
}
return;
case "Nothing" :
Datastruct._radius--;
if (Datastruct._radius < 5) {
Datastruct._state = 0;
_root["Orbiter_" + Datastruct._id].gotoAndStop(8);
release_new_orbiter();
} else {
Datastruct._orbitrotation = Global._orbitrotation + (Datastruct._orbitslot * 36);
Datastruct._xpos = OrbitronInfo_1._xpos + (Datastruct._radius * Math.cos(Datastruct._orbitrotation * _root.Global.PiCalculation));
Datastruct._ypos = OrbitronInfo_1._ypos + (Datastruct._radius * Math.sin(Datastruct._orbitrotation * _root.Global.PiCalculation));
}
}
}
function move_MovieClip(Datastruct) {
Datastruct._xpos = Datastruct._xpos + Datastruct._xs;
Datastruct._ypos = Datastruct._ypos + Datastruct._ys;
if ((Datastruct._xpos > Global.WorldMax_x) || (Datastruct._xpos < 0)) {
Datastruct._xs = -Datastruct._xs;
}
if ((Datastruct._ypos > Global.WorldMax_y) || (Datastruct._ypos < 0)) {
Datastruct._ys = -Datastruct._ys;
}
}
function float_MovieClip(Datastruct) {
Datastruct._xpos = Datastruct._xpos + (random(Datastruct._speed + 1) - (Datastruct._speed / 2));
Datastruct._ypos = Datastruct._ypos + (random(Datastruct._speed + 1) - (Datastruct._speed / 2));
if ((Datastruct._xpos > Global.WorldMax_x) || (Datastruct._xpos < 0)) {
Datastruct._xs = -Datastruct._xs;
}
if ((Datastruct._ypos > Global.WorldMax_y) || (Datastruct._ypos < 0)) {
Datastruct._ys = -Datastruct._ys;
}
}
function evade_orbitron(Datastruct) {
if (Datastruct._xpos > OrbitronInfo_1._xpos) {
Datastruct._xpos = Datastruct._xpos + Datastruct._speed;
} else {
Datastruct._xpos = Datastruct._xpos - Datastruct._speed;
}
if (Datastruct._ypos > OrbitronInfo_1._ypos) {
Datastruct._ypos = Datastruct._ypos + Datastruct._speed;
} else {
Datastruct._ypos = Datastruct._ypos - Datastruct._speed;
}
if ((Datastruct._xpos > Global.WorldMax_x) || (Datastruct._xpos < 0)) {
Datastruct._xs = -Datastruct._xs;
}
if ((Datastruct._ypos > Global.WorldMax_y) || (Datastruct._ypos < 0)) {
Datastruct._ys = -Datastruct._ys;
}
xdiff = Math.abs(Datastruct._xpos - OrbitronInfo_1._xpos);
ydiff = Math.abs(Datastruct._ypos - OrbitronInfo_1._ypos);
if ((xdiff > 150) && (ydiff > 150)) {
Datastruct._state = "Floating";
trace("now floating");
}
}
function find_target() {
target_id = 0;
mindist = 5000;
t_index = 1;
while (t_index <= Global.Object_Count) {
if (_root["ObjectInfo_" + t_index]._state == 1) {
xdiff = Math.abs(_root["ObjectInfo_" + t_index]._xpos - _root.OrbitronInfo_1._xpos);
ydiff = Math.abs(_root["ObjectInfo_" + t_index]._ypos - _root.OrbitronInfo_1._ypos);
dist = xdiff + ydiff;
if (dist < mindist) {
target_id = t_index;
mindist = dist;
}
}
t_index++;
}
if (target_id > 0) {
_root["ObjectInfo_" + target_id]._marked = 1;
}
return(target_id);
}
function fire_orbiter(index) {
with (_root["OrbiterInfo_" + index]) {
_state = "Shooting";
_speed = 25;
FireAngle = (_orbitrotation * (Math.PI/180)) + 90;
_xs = _speed * Math.cos(FireAngle);
_ys = _speed * Math.sin(FireAngle);
Global.ActiveOrbiters--;
}
}
function update_orbitron(index) {
move_orbitron(_root["OrbitronInfo_" + index]);
MC_pos("Orbitron_" + index, _root["OrbitronInfo_" + index]._xpos, _root["OrbitronInfo_" + index]._ypos);
}
function update_orbiter(index) {
move_orbiter(_root["OrbiterInfo_" + index]);
MC_pos(_root["Orbiter_" + index], _root["OrbiterInfo_" + index]._xpos, _root["OrbiterInfo_" + index]._ypos);
}
function orbiter_ai(Datastruct) {
if ((GetDistance(Datastruct, OrbitronInfo_1) < 70) && (Datastruct._state != "Orbiting")) {
}
}
function update_planet(index) {
new_xpos = _root["PlanetInfo_" + index]._xpos - Global.Viewport_x;
new_ypos = _root["PlanetInfo_" + index]._ypos - Global.Viewport_y;
MC_pos(_root["Planet_" + index], new_xpos, new_ypos);
}
function update_object(index) {
switch (_root["ObjectInfo_" + index]._state) {
case 1 :
move_MovieClip(_root["ObjectInfo_" + index]);
setProperty(_root["Object_" + index], _x , _root["ObjectInfo_" + index]._xpos);
setProperty(_root["Object_" + index], _y , _root["ObjectInfo_" + index]._ypos);
rotate_object(_root["ObjectInfo_" + index]);
break;
case 2 :
rotate_object(_root["ObjectInfo_" + index]);
}
setProperty(_root["Object_" + index], _rotation , _root["ObjectInfo_" + index]._rotation);
}
function orbiter_handler() {
Global._orbitrotation = Global._orbitrotation + Global._orbitspeed;
index = 1;
while (index <= Global.Orbiter_Count) {
update_orbiter(index);
index++;
}
}
function planet_handler() {
index = 1;
while (index <= Global.Planet_Count) {
update_planet(index);
index++;
}
}
function update_objects() {
index = 1;
while (index <= Global.Object_Count) {
update_object(index);
index++;
}
}
function update_orbitrons() {
index = 1;
while (index <= Global.Orbitron_Count) {
update_orbitron(index);
index++;
}
}
function check_collision_orbitron() {
o_index = 1;
while (o_index <= Global.Object_Count) {
with (_root["ObjectInfo_" + o_index]) {
if (((_state == "Active") && (_type)) && (OrbitronInfo_1._type)) {
if (Orbitron_1.hitTest(_root["Object_" + o_index], true) == true) {
start_explosion(_root.OrbitronInfo_1._xpos, _root.OrbitronInfo_1._ypos);
}
}
}
o_index++;
}
}
function check_collision_orbiter() {
index = 1;
while (index <= Global.Orbiter_Count) {
with (_root["OrbiterInfo_" + index]) {
if (_state == "Active") {
if (Orbitron_1.hitTest(_root["Orbiter_" + index])) {
if (_type == OrbitronInfo_1._type) {
if (_scale <= _root.OrbitronInfo_1._scale) {
_state = "Orbiting";
_radius = 1;
Global.ActiveOrbiters++;
_orbitslot = Global.ActiveOrbiters;
Global.Score = Global.Score + 100;
SFX_Blip.start();
}
} else if (check_sphere_collision(index)) {
SFX_Explosion.start();
start_explosion(_root.OrbitronInfo_1._xpos, _root.OrbitronInfo_1._ypos);
Global._state = "GameOver";
}
}
}
}
index++;
}
}
function remaining_shooters() {
orbiter_count = 0;
index = 1;
while (index <= Global.Orbiter_Count) {
with (_root["OrbiterInfo_" + index]) {
if (_state == "Shooting") {
orbiter_count++;
}
}
index++;
}
return(orbiter_count);
}
function remaining_orbiters(sphereType) {
orbiter_count = 0;
index = 1;
while (index <= Global.Orbiter_Count) {
with (_root["OrbiterInfo_" + index]) {
if ((((_type == sphereType) && (_state == "Active")) || ((sphereType == 0) && (_state == "Active"))) || ((sphereType == 0) && (_state == "Shooting"))) {
orbiter_count++;
}
}
index++;
}
return(orbiter_count);
}
function check_collision_objects(Datastruct) {
Orbiter = "Orbiter_" + Datastruct._id;
c_index = 1;
while (c_index <= Global.Object_Count) {
if ((_root["ObjectInfo_" + c_index]._state == 1) && (Global.ActiveOrbiters < Global.EvolveCount)) {
if (_root[Orbiter].hitTest(_root["Object_" + c_index]) == true) {
_root["ObjectInfo_" + c_index]._state = 0;
setProperty(_root["Object_" + c_index], _visible , 0);
start_explosion(_root["ObjectInfo_" + c_index]._xpos, _root["ObjectInfo_" + c_index]._ypos);
Global.Score = Global.Score + 50;
Datastruct._state = 0;
Datastruct._xpos = -200;
Datastruct._ypos = -200;
_root[Orbiter].gotoAndPlay(8);
}
}
c_index++;
}
}
function start_explosion(xpos, ypos) {
c_exp = 1;
while (c_exp <= Global.Explosion_Count) {
if (_root["Explosion_" + c_exp]._visible == 0) {
_root["ExplosionInfo_" + c_exp]._state = "Active";
_root["Explosion_" + c_exp]._x = xpos;
_root["Explosion_" + c_exp]._y = ypos;
tellTarget ("_level0/Explosion_" + c_exp) {
gotoAndPlay (1);
};
setProperty("Explosion_" + c_exp, _visible , 1);
break;
}
c_exp++;
}
}
function start_evolution() {
o = 1;
while (o <= Global.Orbiter_Count) {
if (_root["OrbiterInfo_" + o]._state == "Orbiting") {
fire_orbiter(o);
}
o++;
}
}
function release_new_orbiter() {
o = 1;
while (o <= Global.Orbiter_Count) {
if (_root["OrbiterInfo_" + o]._state == "Inactive") {
_root["OrbiterInfo_" + o]._state = "Dropping";
_root["OrbiterInfo_" + o]._type = Global._level;
_root["OrbiterInfo_" + o]._xpos = random(Global.Max_x - 20) + 10;
_root["OrbiterInfo_" + o]._ypos = 0;
_root["OrbiterInfo_" + o]._speed = Global._level;
_root["OrbiterInfo_" + o]._xs = 0;
_root["OrbiterInfo_" + o]._ys = _root["OrbiterInfo_" + o]._speed;
_root["Orbiter_" + o].gotoAndStop(_root["OrbiterInfo_" + o]._type);
_root["Orbiter_" + o].filters = [];
Global.ActiveOrbs++;
break;
}
o++;
}
}
function reset_game() {
Global.ActiveOrbiters = 0;
Global.ActiveOrbitrons = 0;
Global.Score = 0;
Global._level = 1;
Init_Orbitron(Global._level);
}
function set_up_level(cur_level) {
Init_Orbitron(cur_level);
Init_Orbiters(cur_level);
}
function update_score_UI() {
_root.ScorePanel.ScoreText.text = int(_root.Global.Score);
if (Global.Score > Global.HighScore) {
Global.HighScore = Global.Score;
}
_root.HighScorePanel.ScoreText.text = int(_root.Global.HighScore);
_root.BonusPanel.ScoreText.text = int(_root.Global.Cur_Bonus);
_root.LevelPanel.ScoreText.text = _root.Global._level;
}
function level_window_check() {
if (LevelPanel._x < (Global.Max_x - (LevelPanel._width + 10))) {
LevelPanel._x = LevelPanel._x + 11;
} else {
LevelPanel._x = Global.Max_x - (LevelPanel._width + 10);
}
}
function increment_level() {
Global._level++;
Global.ActiveGhoulTypes++;
if (Global.ActiveGhoulTypes > Global.ActiveGhoulTypes) {
Global.ActiveGhoulTypes = Global.GhoulTypes;
}
Global._levelCounter = Global.GhoulsPerLevel;
Global.RotationSpeed = Global.RotationSpeed + 0.25;
if (Global.RotationSpeed > Global.MaxRotationSpeed) {
Global.RotatationSpeed = Global.MaxRotationSpeed;
}
switch (Global._level) {
case 2 :
break;
case 3 :
}
display_new_level();
new_background();
update_background();
}
function check_distance(id, loc_x, loc_y) {
outcome = true;
b = 1;
while (b <= Global.Orbiter_Count) {
with (_root["OrbiterInfo_" + b]) {
if ((_state == "Active") && (b != id)) {
xdiff = Math.abs(_xpos - loc_x);
ydiff = Math.abs(_ypos - loc_y);
if ((xdiff < Global._orbiterSpacing) && (ydiff < Global._orbiterSpacing)) {
outcome = false;
break;
}
}
}
b++;
}
return(outcome);
}
function check_sphere_collision(id) {
collision_status = false;
with (OrbitronInfo_1) {
Radius = Orbitron_1._width / 2;
angle = 90.7853981633974;
x1 = (Radius * Math.cos(angle)) + _xpos;
y1 = (Radius * Math.sin(angle)) + _ypos;
angle = 92.3561944901924;
x2 = (Radius * Math.cos(angle)) + _xpos;
y2 = (Radius * Math.sin(angle)) + _ypos;
angle = 93.9269908169872;
x3 = (Radius * Math.cos(angle)) + _xpos;
y3 = (Radius * Math.sin(angle)) + _ypos;
angle = 95.4977871437821;
x4 = (Radius * Math.cos(angle)) + _xpos;
y4 = (Radius * Math.sin(angle)) + _ypos;
if (_root["Orbiter_" + id].hitTest(x1, y1, true)) {
collision_status = true;
}
if (_root["Orbiter_" + id].hitTest(x2, y2, true)) {
collision_status = true;
}
if (_root["Orbiter_" + id].hitTest(x3, y3, true)) {
collision_status = true;
}
if (_root["Orbiter_" + id].hitTest(x4, y4, true)) {
collision_status = true;
}
}
return(collision_status);
}
function hide_spheres() {
b = 1;
while (b <= Global.Orbiter_Count) {
MC_hide("Orbiter_" + b);
b++;
}
MC_hide(Orbitron_1);
}
function Preloader_Status() {
myLoaded = Math.round(getBytesLoaded());
myTotal = Math.round(getBytesTotal());
myPercent = myLoaded / myTotal;
return(myPercent * 100);
}
function Create_MovieClip(ObjectName, Instance, NewLevel) {
if (isNaN(Global[Instance + "_Count"])) {
Global[Instance + "_Count"] = 0;
}
Global[Instance + "_Count"]++;
Index = Global[Instance + "_Count"];
InstanceName = (Instance + "_") + Index;
InstanceInfoName = (Instance + "Info_") + Index;
SymbolName = ObjectName + "Symbol";
_root[InstanceInfoName] = new SpriteParent(Index, InstanceName);
_root.attachMovie(SymbolName, InstanceName, NewLevel);
_root[InstanceName].cacheAsBitmap;
MC_hide(InstanceName);
return(Index);
}
function create_instance(ObjectName, amount, Instance, TargetLevel) {
c_instance = 1;
while (c_instance <= amount) {
New_Index = Create_MovieClip(ObjectName, Instance, (TargetLevel + c_instance) - 1);
c_instance++;
}
}
function MC_alpha(InstanceName, pct) {
setProperty(InstanceName, _alpha , pct);
}
function MC_rotate(InstanceName, angle) {
setProperty(InstanceName, _rotation , angle);
}
function MC_pos(InstanceName, loc_x, loc_y) {
setProperty(InstanceName, _x , loc_x);
setProperty(InstanceName, _y , loc_y);
}
function MC_scale(InstanceName, newscale) {
setProperty(InstanceName, _xscale , newscale);
setProperty(InstanceName, _yscale , newscale);
}
function MC_size(InstanceName, new_width, new_height) {
setProperty(InstanceName, _width , new_width);
setProperty(InstanceName, _height , new_height);
}
function MC_show(InstanceName) {
setProperty(InstanceName, _visible , 1);
}
function MC_hide(InstanceName) {
setProperty(InstanceName, _visible , 0);
}
function set_object_color(ObjectName, ColorCode) {
var _local2 = new Color(_root[ObjectName]);
_local2.setRGB(ColorCode);
}
function display_prompt(PromptText, loc_x, loc_y) {
Prompt.PromptText.text = PromptText;
MC_pos("Prompt", loc_x, loc_y);
MC_show("Prompt");
}
function Process_Control_Input(KeyCode) {
switch (Global._state) {
case "Loading" :
break;
case "MainMenu" :
if (MainMenu_1.StartGame.hitTest(_root._xmouse, _root._ymouse)) {
MC_hide(MainMenu_1);
reset_game();
Global._state = "LevelStart";
}
if (MainMenu_1.Instructions.hitTest(_root._xmouse, _root._ymouse)) {
MC_hide(MainMenu_1);
Global._state = "Instructions";
}
break;
case "Core" :
break;
case "LevelChange" :
break;
case "LevelStart" :
if (LevelChange_1.Continue.hitTest(_root._xmouse, _root._ymouse)) {
MC_hide(LevelChange_1);
show_ui();
set_up_level(Global._level);
level_setup(Global._level);
Global._initTime = getTimer();
Global._state = "Core";
}
break;
case "GameOver" :
if (GameOver_1.Back.hitTest(_root._xmouse, _root._ymouse)) {
hide_spheres();
Mouse.show;
MC_hide(GameOver_1);
Global._state = "MainMenu";
}
if (GameOver_1.HighScoreList.hitTest(_root._xmouse, _root._ymouse)) {
getURL ("http://www.gamestack.org/viewpage.php?page_id=10&game=221");
}
break;
case "HighScores" :
break;
case "Instructions" :
if (Instructions_1.Back.hitTest(_root._xmouse, _root._ymouse)) {
MC_hide(Instructions_1);
Global._state = "MainMenu";
}
break;
case "ResetGame" :
Global._state = "Core";
}
}
function Init_Orbitron(cur_level) {
OrbitronInfo_1._xpos = Global.Max_x / 2;
OrbitronInfo_1._ypos = Global.Max_y / 2;
OrbitronInfo_1._type = 1;
Orbitron_1.gotoAndStop(1);
Orbitron_1.filters = [glow];
MC_show(Orbitron_1);
}
function Init_Orbiters(cur_level) {
index = 1;
while (index <= Global.Orbiter_Count) {
with (_root["OrbiterInfo_" + index]) {
if (index <= (cur_level * Global._orbitersPerLevel)) {
_state = "Active";
_xpos = -50;
_ypos = -50;
_speed = 15;
_scalestep = random(2) + 2;
}
}
index++;
}
o_type = 1;
o_count = 1;
index = 1;
while (index <= Global.Orbiter_Count) {
with (_root["OrbiterInfo_" + index]) {
if (o_type <= cur_level) {
GoodLocation = false;
while (GoodLocation == false) {
_xpos = random(Global.Max_x - 50) + 25;
_ypos = random(Global.Max_y - 200) + 50;
GoodLocation = check_distance(index, _xpos, _ypos);
}
_type = o_type;
_speed = random(3) + 2;
_scale = random(65) + 35;
_root["Orbiter_" + index].IndexText.text = index;
_root["Orbiter_" + index].gotoAndStop(_type);
MC_scale(_root["Orbiter_" + index], _scale);
MC_show(_root["Orbiter_" + index]);
} else {
_xpos = -50;
_ypos = -50;
_state = "Inactive";
MC_hide(_root["Orbiter_" + index]);
}
o_count++;
if (o_count > Global._orbitersPerLevel) {
o_count = 1;
o_type++;
}
}
index++;
}
}
function Init_Asteroids() {
index = 1;
while (index <= Global.Asteroid_Count) {
_root["AsteroidInfo_" + index]._xpos = random(Global.Max_x);
_root["AsteroidInfo_" + index]._ypos = random(Global.Max_y);
_root["AsteroidInfo_" + index]._type = random(7);
c_speed = random(5) + 2;
_root["AsteroidInfo_" + index]._xspeed = c_speed;
_root["AsteroidInfo_" + index]._yspeed = c_speed;
_root["Asteroid_" + index].gotoAndStop(_root["AsteroidInfo_" + index]._type);
index++;
}
}
function Init_Planets() {
index = 1;
while (index <= Global.Planet_Count) {
_root["PlanetInfo_" + index]._xpos = random(Global.WorldMax_x);
_root["PlanetInfo_" + index]._ypos = random(Global.WorldMax_y);
_root["PlanetInfo_" + index]._type = random(10);
MC_pos(_root["Planet_" + index], _root["PlanetInfo_" + index]._xpos, _root["PlanetInfo_" + index]._ypos);
_root["Planet_" + index].gotoAndStop(_root["PlanetInfo_" + index]._type);
index++;
}
}
function Init_Explosions() {
index = 1;
while (index <= Global.Explosion_Count) {
_root["ExplosionInfo_" + index]._xpos = -100;
_root["ExplosionInfo_" + index]._ypos = -100;
setProperty(_root["Explosion_" + index], _xscale , Global.ExplosionScale);
setProperty(_root["Explosion_" + index], _yscale , Global.ExplosionScale);
_root["Explosion_" + index].gotoAndStop(_root["ExplosionInfo_" + index]._type);
MC_hide("Explosion_" + index);
index++;
}
}
function check_mainmenu_rollovers() {
MC_rotate(MainMenu_1.StartGame, random(5) - 2);
MC_rotate(MainMenu_1.Instructions, random(5) - 2);
MC_rotate(MainMenu_1.VisitGamestack, random(5) - 2);
if (MainMenu_1.StartGame.hitTest(_root._xmouse, _root._ymouse)) {
MC_scale(MainMenu_1.StartGame, 150);
} else {
MC_scale(MainMenu_1.StartGame, 100);
}
if (MainMenu_1.Instructions.hitTest(_root._xmouse, _root._ymouse)) {
MC_scale(MainMenu_1.Instructions, 150);
} else {
MC_scale(MainMenu_1.Instructions, 100);
}
if (MainMenu_1.VisitGamestack.hitTest(_root._xmouse, _root._ymouse)) {
MC_scale(MainMenu_1.VisitGamestack, 150);
} else {
MC_scale(MainMenu_1.VisitGamestack, 100);
}
}
function check_Instructions_rollovers() {
MC_rotate(Instructions_1.Back, random(5) - 2);
if (Instructions_1.Back.hitTest(_root._xmouse, _root._ymouse)) {
MC_scale(Instructions_1.Back, 150);
} else {
MC_scale(Instructions_1.Back, 100);
}
}
function check_gameover_rollovers() {
MC_rotate(GameOver_1.Back, random(5) - 2);
MC_rotate(GameOver_1.HighScoreList, random(5) - 2);
if (GameOver_1.Back.hitTest(_root._xmouse, _root._ymouse)) {
MC_scale(GameOver_1.Back, 150);
} else {
MC_scale(GameOver_1.Back, 100);
}
if (GameOver_1.HighScoreList.hitTest(_root._xmouse, _root._ymouse)) {
MC_scale(GameOver_1.HighScoreList, 150);
} else {
MC_scale(GameOver_1.HighScoreList, 100);
}
}
function update_score_UI() {
ScorePanel_1.ScoreText.text = int(_root.Global.Score);
if (Global.Score > Global.HighScore) {
Global.HighScore = Global.Score;
}
HighScorePanel_1.ScoreText.text = int(_root.Global.HighScore);
LevelPanel_1.ScoreText.text = Global._level;
}
function hide_ui() {
MC_hide(ScorePanel_1);
MC_hide(HighScorePanel_1);
MC_hide(LevelPanel_1);
}
function show_ui() {
MC_show(ScorePanel_1);
MC_show(HighScorePanel_1);
MC_show(LevelPanel_1);
}
function create_ui() {
create_instance("Score", 1, "ScorePanel", 2000);
MC_pos(ScorePanel_1, 0, 0);
create_instance("Score", 1, "HighScorePanel", 2001);
MC_pos(HighScorePanel_1, Global.Max_x - (HighScorePanel_1._width + 10), 2);
HighScorePanel_1.Label.text = "Hi-Score : ";
create_instance("Score", 1, "LevelPanel", 2002);
LevelPanelInfo_1._xpos = 5;
LevelPanelInfo_1._ypos = Global.Max_y - (LevelPanel_1._height - 2);
MC_pos(LevelPanel_1, LevelPanelInfo_1._xpos, LevelPanelInfo_1._ypos);
LevelPanel_1.Label.text = "Level ";
create_instance("GameOver", 1, "GameOver", 2003);
MC_pos(GameOver_1, 0, 0);
MC_hide(GameOver_1);
create_instance("MainMenu", 1, "MainMenu", 2004);
MC_pos(MainMenu_1, 0, 0);
MC_hide(MainMenu_1);
create_instance("Instructions", 1, "Instructions", 2005);
MC_pos(Instructions_1, 0, 0);
MC_hide(Instructions_1);
create_instance("LevelChange", 1, "LevelChange", 2006);
MC_pos(LevelChange_1, 0, 0);
MC_hide(LevelChange_1);
}
function main_loop() {
switch (Global._state) {
case "MainMenu" :
Mouse.show;
update_background();
if (MainMenu_1._visible == 0) {
hide_ui();
MC_show(MainMenu_1);
}
check_mainmenu_rollovers();
return;
case "Core" :
Mouse.hide();
update_background();
update_orbitrons();
check_collision_orbiter();
orbiter_handler();
if ((remaining_orbiters(OrbitronInfo_1._type) == 0) && (Global._evolve == false)) {
start_evolution();
Global._evolve = true;
OrbitronInfo_1._type++;
Orbitron_1.gotoAndStop(OrbitronInfo_1._type);
}
if (remaining_shooters() == 0) {
Global._evolve = false;
}
if ((remaining_orbiters(0) == 0) && (Global._evolve == false)) {
hide_ui();
Global._state = "LevelChange";
if (Global._level == 7) {
Global._state = "GameOver";
}
}
update_score_UI();
return;
case "LevelChange" :
Mouse.hide();
update_background();
update_orbitrons();
OrbitronInfo_1._type = 1;
Orbitron_1.gotoAndStop(OrbitronInfo_1._type);
update_background();
if (LevelChange_1._visible == 0) {
MC_show(LevelChange_1);
BonusPoints = int(200 - update_timer()) * (5 * Global._level);
NewBonusPoints = BonusPoints;
NewScore = Global.Score;
MC_hide(LevelChange_1.Continue);
MC_show(LevelChange_1.BonusText);
MC_show(LevelChange_1.ScoreText);
LevelChange_1.BonusText.text = "Time Bonus\r" + BonusPoints;
} else if (NewBonusPoints > 0) {
NewScore = NewScore + int(BonusPoints / 50);
NewBonusPoints = NewBonusPoints - int(BonusPoints / 50);
if (NewScore > (Global.Score + BonusPoints)) {
NewScore = Global.Score + BonusPoints;
}
}
if (NewBonusPoints <= 0) {
Global.Score = Global.Score + BonusPoints;
Global._level++;
MC_hide(LevelChange_1);
Global._state = "LevelStart";
}
LevelChange_1.ScoreText.text = "Score\r" + NewScore;
return;
case "LevelStart" :
update_background();
update_orbitrons();
if (LevelChange_1._visible == 0) {
MC_show(LevelChange_1);
MC_show(LevelChange_1.Continue);
MC_hide(LevelChange_1.BonusText);
MC_show(LevelChange_1.ScoreText);
if (Global._level == 1) {
MC_hide(LevelChange_1.ScoreText);
}
}
return;
case "GameOver" :
Mouse.show();
check_gameover_rollovers();
if (GameOver_1._visible == 0) {
hide_ui();
MC_show(GameOver_1);
if (Global.Score > Global.HighScore) {
Global.HighScore = Global.Score;
}
GameOver_1.ScoreText.text = "Score\r" + Global.Score;
GameOver_1.HighScoreText.text = "High Score\r" + Global.HighScore;
}
return;
case "Instructions" :
if (Instructions_1._visible == 0) {
MC_show(Instructions_1);
}
check_Instructions_rollovers();
return;
case "DisplayHighScores" :
return;
case "LevelChange" :
if (LevelText_1._visible == 0) {
LevelText_1.LevelText.text = "Level " + Global._level;
MC_show(LevelText_1);
}
Global._levelTextTimer--;
if (Global._levelTextTimer < 1) {
MC_hide(LevelText_1);
Global._state = "Core";
}
return;
case "ResetGame" :
reset_game();
show_ui();
Global._state = "MainMenu";
return;
case "Credits" :
}
}
function update_timer() {
elapsedTime = (getTimer() - Global._initTime) / 1000;
elapsedTime = int(elapsedTime * 100) / 100;
return(elapsedTime);
}
function timeString(TimerValue) {
minutes = int(TimerValue / 60);
seconds = int(TimerValue - (minutes * 60));
extra = int((TimerValue - ((minutes * 60) + seconds)) * 100);
if (seconds < 10) {
seconds = "0" + seconds;
}
TimeValueString = (((minutes + ":") + seconds) + ".") + extra;
return(TimeValueString);
}
function LevelDataParent() {
this._balls = 0;
this._targetTime = 0;
}
function update_level_boxes() {
t = 1;
while (t <= Global.Theme_Count) {
l = 1;
while (l <= Global.Level_Count) {
BoxIndex = ((t - 1) * Global.Level_Count) + l;
MainMenu_1.Levels["LevelBox_" + BoxIndex].BoxText.text = (((_root["Theme_" + t] + "\r") + _root["Difficulty_" + l]) + "\r") + timeString(BestTimes[t][l]);
if (Levels[t][l] == true) {
MC_show(MainMenu_1.Levels["LevelBox_" + BoxIndex].Star);
} else {
MC_hide(MainMenu_1.Levels["LevelBox_" + BoxIndex].Star);
}
l++;
}
t++;
}
}
function levelbox_rollovers() {
t = 1;
while (t <= (Global.Theme_Count * Global.Level_Count)) {
MainMenu_1.Levels["LevelBox_" + t].Star._rotation = MainMenu_1.Levels["LevelBox_" + t].Star._rotation + 5;
if (MainMenu_1.Levels["LevelBox_" + t].hitTest(_root._xmouse, _root._ymouse)) {
MC_alpha(MainMenu_1.Levels["LevelBox_" + t].Box, 70);
} else {
MC_alpha(MainMenu_1.Levels["LevelBox_" + t].Box, 35);
}
t++;
}
}
function levelbox_click() {
t = 1;
while (t <= (Global.Theme_Count * Global.Level_Count)) {
if (MainMenu_1.Levels["LevelBox_" + t].hitTest(_root._xmouse, _root._ymouse)) {
Global._theme = Math.floor(((t - 1) / Global.Level_Count) + 1);
Global._level = t - ((Global._theme - 1) * Global.Level_Count);
MC_hide(MainMenu_1);
Global._state = "LevelStart";
}
t++;
}
}
function level_setup(NewLevel) {
init_oribiters(NewLevel);
init_oribitron(NewLevel);
MC_show("Timer_1");
MC_show("TargetTimer_1");
Global._initTime = getTimer();
change_background(ThemeData._background);
}
function set_level_data(NewLevel) {
with (LevelData) {
switch (NewLevel) {
case 1 :
_balls = 5;
break;
case 2 :
_balls = 10;
break;
case 3 :
_balls = 15;
break;
case 4 :
_balls = 20;
break;
case 5 :
_balls = 26;
}
LevelData._targetTime = _balls * 4;
}
}
function ThemeDataParent() {
this._background = 0;
this._ballType = 0;
this._rotate = false;
this._alpha = 0;
this._pulse = false;
this._scale = false;
this._bubbles = false;
this._slide = false;
this._slidestep = 0;
this._scalestep = 0;
}
function set_theme_data(NewTheme) {
with (ThemeData) {
switch (NewTheme) {
case 1 :
_slidestep = 0.25;
_background = 1;
_rotate = false;
_alpha = 100;
_pulse = false;
_scale = false;
_bubbles = false;
_slide = true;
break;
case 2 :
_background = 2;
_ballType = 2;
_rotate = false;
_alpha = 100;
_pulse = false;
_scale = false;
_bubbles = true;
break;
case 3 :
_background = 4;
_ballType = 3;
_rotate = false;
_alpha = 100;
_pulse = false;
_scale = false;
_bubbles = false;
break;
case 4 :
_background = 3;
_ballType = -1;
_rotate = true;
_alpha = 100;
_pulse = false;
_scale = true;
_bubbles = false;
}
change_background(_background);
MC_rotate(Background_1, 0);
MC_scale(Background_1, 100);
MC_alpha(Background_1, _alpha);
if (_pulse) {
MC_show(Pulse_1);
} else {
MC_hide(Pulse_1);
}
if (_bubbles) {
init_bubbles();
}
}
}
function rotate_background() {
Background_1._rotation = Background_1._rotation + 0.05;
}
function slide_background(Min_x, Max_x) {
BackgroundInfo_1._xpos = BackgroundInfo_1._xpos + ThemeData._slidestep;
if ((BackgroundInfo_1._xpos > Max_x) || (BackgroundInfo_1._xpos < Min_x)) {
ThemeData._slidestep = -ThemeData._slidestep;
}
MC_pos(Background_1, BackgroundInfo_1._xpos, BackgroundInfo_1._ypos);
}
function scale_background(Min_scale, Max_scale) {
BackgroundInfo_1._scale = BackgroundInfo_1._scale + ThemeData._scalestep;
if ((BackgroundInfo_1._scale > Max_scale) || (BackgroundInfo_1._scale < Min_scale)) {
ThemeData._scalestep = -ThemeData._scalestep;
}
MC_scale(Background_1, BackgroundInfo_1._scale);
}
function update_pulse(pulseSpeed) {
Pulse_1._xscale = Pulse_1._xscale + pulseSpeed;
Pulse_1._yscale = Pulse_1._yscale + pulseSpeed;
if (Pulse_1._xscale > 400) {
Pulse_1._xscale = 0;
Pulse_1._yscale = 0;
}
}
function change_background(NewIndex) {
Background_1.gotoAndStop(NewIndex);
}
function update_background() {
with (ThemeData) {
if (_pulse) {
update_pulse();
}
if (_rotate) {
rotate_background();
}
if (_scale) {
scale_background();
}
if (_bubbles) {
update_bubbles();
}
if (_slide) {
slide_background(-100, 100);
}
}
}
Global = new GlobalParent();
Controls = new ControlsParent();
ThemeData = new ThemeDataParent();
LevelData = new LevelDataParent();
var blur = (new flash.filters.BlurFilter(10, 10, 3));
var drop = (new flash.filters.DropShadowFilter(40, 45, 0, 0.3, 10, 10, 2, Quality.HIGH));
var glow = (new flash.filters.GlowFilter(16777215, 0.5, 5, 5, 2, 3));
create_instance("LoadBar", 1, "LoadBar", 60);
MC_pos(LoadBar_1, 0, 0);
MC_show(LoadBar_1);
userKey = new Object();
Key.addListener(userKey);
userKey.onKeyDown = function () {
KeyCode = Number(Key.getCode());
Process_Control_Input(KeyCode);
};
mouseObj = new Object();
Mouse.addListener(mouseObj);
mouseObj.onMouseDown = function () {
Process_Control_Input(0);
};
create_instance("Background", 1, "Background", 50);
BackgroundInfo_1._xpos = 0;
BackgroundInfo_1._ypos = 0;
MC_pos(Background_1, BackgroundInfo_1._xpos, BackgroundInfo_1._ypos);
MC_show(Background_1);
Frame 3
LoadBar_1.LoadText.text = ("Loading : " + int(Preloader_Status())) + "%";
if (Preloader_Status() < 100) {
gotoAndPlay (2);
}
Frame 5
MC_hide(LoadBar_1);
set_theme_data(Global._theme);
SFX_Music = new Sound();
SFX_Music.attachSound("MysticalLake");
SFX_Music.start();
SFX_Blip = new Sound();
SFX_Blip.attachSound("Click");
SFX_Explosion = new Sound();
SFX_Explosion.attachSound("Explosion");
SFX_Music.onSoundComplete = function () {
SFX_Music.start();
};
create_instance("ColoredSphere", 100, "Orbiter", 300);
create_instance("ColoredSphere", 1, "Orbitron", 2500);
create_instance("Explosion", 30, "Explosion", 2600);
create_ui();
hide_ui();
Global._state = "MainMenu";
Frame 6
main_loop();
Frame 7
gotoAndPlay (6);
Symbol 46 MovieClip [ExplosionSymbol] Frame 15
this._visible = 0;
stop();
Symbol 124 MovieClip [Audio] Frame 1
stop();