Instance of Symbol 664 MovieClip in Frame 1
//component parameters
onClipEvent (construct) {
xin_motion_val = "Toward";
xin_alphatype_val = "No";
xout_motion_val = "None";
xout_alphatype_val = "No";
perc_req_val = 100;
show_perc_val = "Yes";
slow_factor_val = 0.2;
init_action_val = "_root.stop();";
play_action_val = "_root.play();";
}
Frame 72
stop();
Frame 73
stop();
Instance of Symbol 792 MovieClip in Frame 73
//component parameters
onClipEvent (construct) {
quiz_data_file = "";
shuffle_questions = "True";
direction = "Top to Bottom";
num_rows = 3;
num_columns = 7;
enemy_spacing_x = 10;
enemy_spacing_y = 10;
player_control = "Mouse and Click";
enemy_score = 10;
level_enemy_score_increase = 5;
num_levels_boss = 2;
boss_score = 250;
level_boss_score_increase = 50;
num_hits_beat_boss = 20;
level_bonus = 100;
level_bonus_increase = 100;
initial_speed = 2;
hit_speed_increase = 0.5;
level_speed_increase = 1;
speed_delay = 1;
shift_displacement = 15;
bottom = 275;
num_lives = 5;
num_points_new_life = 3000;
player_shot_speed = 9;
enemy_shot_speed = 13;
boss_shot_speed = 15;
enemy_shoot_delay = 35;
enemy_shoot_delay_change = -1;
enemy_shoot_delay_minimum = 15;
quiz_enemy_delay = 200;
quiz_enemy_speed = 0.01;
correct_points = 500;
incorrect_points = 100;
}
Frame 74
stop();
Symbol 17 MovieClip [player] Frame 1
stop();
Symbol 17 MovieClip [player] Frame 2
_parent.slingshot_fx.play();
Symbol 29 MovieClip [quiz_enemies] Frame 1
stop();
Symbol 58 MovieClip [enemies] Frame 1
stop();
Symbol 68 MovieClip Frame 1
stop();
Symbol 68 MovieClip Frame 2
stop();
Symbol 68 MovieClip Frame 3
stop();
Symbol 68 MovieClip Frame 4
stop();
Symbol 68 MovieClip Frame 5
stop();
Symbol 68 MovieClip Frame 6
stop();
Symbol 69 MovieClip [enemies_shots] Frame 1
stop();
Symbol 91 MovieClip Frame 1
stop();
Symbol 123 MovieClip Frame 1
stop();
Symbol 150 MovieClip Frame 1
stop();
Symbol 183 MovieClip Frame 1
stop();
Symbol 218 MovieClip Frame 1
stop();
Symbol 246 MovieClip Frame 1
stop();
Symbol 281 MovieClip Frame 1
stop();
Symbol 313 MovieClip Frame 1
stop();
Symbol 340 MovieClip Frame 1
stop();
Symbol 370 MovieClip Frame 1
stop();
Symbol 371 MovieClip [bosses] Frame 1
stop();
Symbol 377 MovieClip [bosses_shots] Frame 1
stop();
Symbol 386 MovieClip [explosion] Frame 2
_parent._parent.boss_hit_fx.play();
Symbol 386 MovieClip [explosion] Frame 23
this._parent._unloadMovie();
Symbol 387 MovieClip [quiz_enemy_explosions] Frame 1
stop();
Symbol 394 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 401 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 408 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 415 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 422 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 429 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 436 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 443 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 450 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 457 MovieClip Frame 14
this._parent._unloadMovie();
Symbol 458 MovieClip [enemy_explosions] Frame 1
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 2
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 3
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 4
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 5
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 6
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 7
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 8
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 9
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 10
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 11
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 12
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 13
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 14
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 15
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 16
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 17
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 18
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 19
_parent.enemyhit_fx.play();
stop();
Symbol 458 MovieClip [enemy_explosions] Frame 20
_parent.enemyhit_fx.play();
stop();
Symbol 459 MovieClip [small_boss_explosions] Frame 1
stop();
Symbol 485 MovieClip Frame 51
this._parent._unloadMovie();
Symbol 507 MovieClip Frame 38
this._parent._unloadMovie();
Symbol 512 MovieClip Frame 37
this._parent._unloadMovie();
Symbol 518 MovieClip Frame 47
this._parent._unloadMovie();
Symbol 524 MovieClip Frame 45
this._parent._unloadMovie();
Symbol 529 MovieClip Frame 35
this._parent._unloadMovie();
Symbol 535 MovieClip Frame 46
this._parent._unloadMovie();
Symbol 543 MovieClip Frame 37
this._parent._unloadMovie();
Symbol 551 MovieClip Frame 37
this._parent._unloadMovie();
Symbol 559 MovieClip Frame 34
this._parent._unloadMovie();
Symbol 560 MovieClip [big_boss_explosions] Frame 1
stop();
Symbol 571 MovieClip [enemy_shot_explosion] Frame 1
this.play();
Symbol 571 MovieClip [enemy_shot_explosion] Frame 45
this._unloadMovie();
Symbol 577 MovieClip [boss_shot_explosion] Frame 1
this.play();
Symbol 577 MovieClip [boss_shot_explosion] Frame 45
this._unloadMovie();
Symbol 588 MovieClip [quiz_enemy_explosion] Frame 1
this.play();
Symbol 588 MovieClip [quiz_enemy_explosion] Frame 45
this._unloadMovie();
Symbol 664 MovieClip Frame 1
stop();
Instance of Symbol 663 MovieClip "swfloader" in Symbol 664 MovieClip Frame 1
onClipEvent (load) {
function strip_spaces(str) {
var _local3 = new String("");
var _local1 = 0;
while (_local1 < str.length) {
if ((str.charAt(_local1) != " ") && (str.charAt(_local1) != ";")) {
_local3 = _local3 + str.charAt(_local1);
}
_local1++;
}
return(_local3);
}
function simple_script(action, timeline) {
action = strip_spaces(action);
if ((action.length > 0) && ((action.indexOf(")") != -1) && (action.indexOf("(") != -1))) {
var _local3 = action.split(".");
var _local5 = _local3.pop();
var _local7 = _local5.indexOf("(");
var _local9 = _local5.indexOf(")");
var _local8 = _local5.substr(0, _local7);
var _local4 = _local5.substr(_local7 + 1, _local9 - (_local7 + 1));
var _local2 = timeline;
var _local1 = 0;
while (_local1 < _local3.length) {
_local2 = _local2[_local3[_local1]];
_local1++;
}
if (_local4.indexOf("\"") != -1) {
_local4 = _local4.substr(1, _local4.length - 2);
}
_local2[_local8](_local4);
}
}
function execute_action() {
unloaded = true;
_parent._visible = false;
simple_script(_parent.play_action_val, _parent);
}
_parent.anim.gotoAndStop(1);
simple_script(_parent.init_action_val, _parent);
var done = false;
var unloaded = false;
var orig_x = _parent._x;
var orig_y = _parent._y;
var dist_x = (_parent._x + ((_parent._width * 2) / 3));
var dist_y = (_parent._y + ((_parent._height * 2) / 3));
var orig_a = _parent._alpha;
var accel_jump = 0.75;
var slow_factor = _parent.slow_factor_val;
var speed_factor = (1 + (slow_factor / (1 - slow_factor)));
var ready = false;
var perc_fadeout = 0;
_parent.perc._x = _parent.anim._x - (_parent.perc._width / 2);
_parent.perc._y = _parent.anim._y - (_parent.perc._height / 2);
if (slow_factor < 1) {
switch (_parent.xin_motion_val) {
case "Up" :
_parent._y = orig_y + (dist_y * 2);
break;
case "Down" :
_parent._y = orig_y - (dist_y * 2);
break;
case "Left" :
_parent._x = orig_x + (dist_x * 2);
break;
case "Right" :
_parent._x = orig_x - (dist_x * 2);
break;
case "Toward" :
_parent._xscale = (_parent._yscale = 1);
break;
case "None" :
_parent._alpha = 0;
}
} else {
ready = true;
}
}
onClipEvent (enterFrame) {
if (unloaded) {
return(undefined);
}
if (!ready) {
switch (_parent.xin_motion_val) {
case "Toward" :
_parent._xscale = _parent._xscale + ((100 - _parent._xscale) * slow_factor);
_parent._yscale = _parent._xscale;
if (_parent.xin_alphatype_val == "Yes") {
_parent._alpha = Math.round((orig_a / 100) * Math.max(0, Math.min(_parent._xscale, 100)));
}
if (Math.abs(100 - _parent._xscale) < 0.5) {
_parent._xscale = (_parent._yscale = 100);
_parent._alpha = orig_a;
ready = true;
}
break;
default :
_parent._x = _parent._x + ((orig_x - _parent._x) * slow_factor);
_parent._y = _parent._y + ((orig_y - _parent._y) * slow_factor);
if (_parent.xin_alphatype_val == "Yes") {
if (_parent.xin_motion_val == "None") {
_parent._alpha = _parent._alpha + ((orig_a - _parent._alpha) * slow_factor);
} else if (Math.abs(orig_x - _parent._x) > Math.abs(orig_y - _parent._y)) {
_parent._alpha = 100 - Math.round(((orig_a / 100) * (Math.min(dist_x, Math.abs(_parent._x - orig_x)) / dist_x)) * 100);
} else {
_parent._alpha = 100 - Math.round(((orig_a / 100) * (Math.min(dist_y, Math.abs(_parent._y - orig_y)) / dist_y)) * 100);
}
}
if (!(((_parent.xin_motion_val == "None") && (Math.abs(_parent._alpha - orig_a) <= 1)) || (((_parent.xin_motion_val != "None") && (Math.abs(_parent._y - orig_y) < 0.5)) && (Math.abs(_parent._x - orig_x) < 0.5)))) {
break;
}
_parent._x = orig_x;
_parent._y = orig_y;
_parent._alpha = orig_a;
ready = true;
}
} else if (!done) {
var rl = _root.getBytesLoaded();
var rt = (_root.getBytesTotal() * (_parent.perc_req_val / 100));
if ((rl > 10) && (rt > 10)) {
rl = Math.min(rl, rt);
var new_frame = (_parent.anim._currentframe + Math.ceil(((_parent.anim._totalframes * (rl / rt)) - _parent.anim._currentframe) / 4));
new_frame = Math.max(1, new_frame);
if (_parent.show_perc_val == "Yes") {
_parent.perc.text = Math.round(((new_frame - 1) / (_parent.anim._totalframes - 1)) * 100) + " %";
}
if (new_frame != _parent.anim._currentframe) {
_parent.anim.gotoAndStop(new_frame);
}
if ((_parent.anim._totalframes == _parent.anim._currentframe) && (rl >= rt)) {
done = true;
}
}
} else if (slow_factor < 1) {
switch (_parent.xout_motion_val) {
case "Down" :
if (_parent._y <= orig_y) {
_parent._y = orig_y + accel_jump;
}
_parent._y = orig_y + (Math.abs(_parent._y - orig_y) * speed_factor);
perc_fadeout = Math.round((Math.min(dist_y, Math.abs(_parent._y - orig_y)) / dist_y) * 100);
if (_parent._y > (orig_y + (dist_y * 2))) {
execute_action();
}
break;
case "Up" :
if (_parent._y >= orig_y) {
_parent._y = orig_y - accel_jump;
}
_parent._y = orig_y - (Math.abs(_parent._y - orig_y) * speed_factor);
perc_fadeout = Math.round((Math.min(dist_y, Math.abs(_parent._y - orig_y)) / dist_y) * 100);
if (_parent._y < (orig_y - (dist_y * 2))) {
execute_action();
}
break;
case "Right" :
if (_parent._x <= orig_x) {
_parent._x = orig_x + accel_jump;
}
_parent._x = orig_x + (Math.abs(_parent._x - orig_x) * speed_factor);
perc_fadeout = Math.round((Math.min(dist_x, Math.abs(_parent._x - orig_x)) / dist_x) * 100);
if (_parent._x > (orig_x + (dist_x * 2))) {
execute_action();
}
break;
case "Left" :
if (_parent._x >= orig_x) {
_parent._x = orig_x - accel_jump;
}
_parent._x = orig_x - (Math.abs(_parent._x - orig_x) * speed_factor);
perc_fadeout = Math.round((Math.min(dist_x, Math.abs(_parent._x - orig_x)) / dist_x) * 100);
if (_parent._x < (orig_x - (dist_x * 2))) {
execute_action();
}
break;
case "Away" :
if ((_parent._xscale >= 100) || (_parent._yscale >= 100)) {
_parent._xscale = (_parent._yscale = 100 - accel_jump);
}
_parent._xscale = (_parent._yscale = Math.max(0.5, 100 - ((100 - _parent._yscale) * speed_factor)));
perc_fadeout = 100 - Math.round(Math.max(0, Math.min(_parent._xscale, 100)));
if (_parent._xscale < 1) {
execute_action();
}
break;
default :
perc_fadeout = perc_fadeout + ((100 - perc_fadeout) * slow_factor);
if (Math.abs(perc_fadeout - 100) > 1) {
break;
}
execute_action();
}
if (!(_parent.xout_alphatype_val === "Yes")) {
} else {
_parent._alpha = (orig_a / 100) * (100 - perc_fadeout);
}
} else {
execute_action();
}
}
Symbol 676 Button
on (release) {
getURL ("http://www.franktownrocks.com");
}
Symbol 698 Button
on (release) {
getURL ("http://www.franktownrocks.com");
}
Symbol 705 Button
on (release) {
this._parent.inst.gotoAndPlay("On");
}
Symbol 706 MovieClip Frame 1
stop();
Symbol 711 Button
on (press) {
this.play();
}
Symbol 727 Button
on (release) {
play();
}
Symbol 728 MovieClip Frame 1
stop();
Symbol 728 MovieClip Frame 6
stop();
Symbol 732 MovieClip Frame 1
stop();
Symbol 741 MovieClip Frame 1
stop();
Symbol 741 MovieClip Frame 91
_parent.game.paused = false;
Symbol 745 Button
on (press) {
_parent._parent.game.evaluate_answer(this);
}
Symbol 772 MovieClip Frame 1
stop();
Symbol 772 MovieClip Frame 20
stop();
Symbol 772 MovieClip Frame 79
_parent.game.answer_prompt_done();
this.gotoAndStop(1);
Symbol 772 MovieClip Frame 138
_parent.game.answer_prompt_done();
this.gotoAndStop(1);
Symbol 776 MovieClip Frame 1
this.stop();
Symbol 780 MovieClip Frame 1
stop();
Symbol 780 MovieClip Frame 2
stop();
Symbol 785 MovieClip Frame 1
stop();
Symbol 785 MovieClip Frame 2
stop();
Symbol 785 MovieClip Frame 3
stop();
Symbol 790 MovieClip Frame 1
stop();
Symbol 790 MovieClip Frame 2
stop();
Symbol 790 MovieClip Frame 3
stop();
Symbol 792 MovieClip Frame 1
Number.prototype.randf = function (a, b) {
return((Math.random() * (b - a)) + a);
};
Number.prototype.randi = function (a, b) {
return(Math.floor(Math.random() * (b - a)) + Math.floor(a));
};
Array.prototype.shuffle = function (a, b) {
var _local2 = this[a];
this[a] = this[b];
this[b] = _local2;
};
Array.prototype.shuffle = function () {
var _local3 = new Number();
var _local2 = 0;
while (_local2 < this.length) {
this.swap(_local2, _local3.randi(0, _local2));
_local2++;
}
};
Array.prototype.rande = function () {
var _local2 = new Number();
return(this[_local2.randi(0, this.length)]);
};
MovieClip.prototype._unloadMovie = function () {
this._x = -1000;
this._y = -1000;
this._visible = false;
this.unloadMovie();
};
GoobersInvaders = function () {
this.load_game_data();
};
GoobersInvaders.prototype.quiz_data_file = quiz_data_file;
GoobersInvaders.prototype.shuffle_questions = shuffle_questions;
GoobersInvaders.prototype.num_levels = Number(num_levels);
GoobersInvaders.prototype.direction = direction;
GoobersInvaders.prototype.num_rows = Number(num_rows);
GoobersInvaders.prototype.num_columns = Number(num_columns);
GoobersInvaders.prototype.enemy_spacing_x = Number(enemy_spacing_x);
GoobersInvaders.prototype.enemy_spacing_y = Number(enemy_spacing_y);
GoobersInvaders.prototype.player_control = player_control;
GoobersInvaders.prototype.enemy_score = Number(enemy_score);
GoobersInvaders.prototype.level_enemy_score_increase = Number(level_enemy_score_increase);
GoobersInvaders.prototype.num_levels_boss = Number(num_levels_boss);
GoobersInvaders.prototype.boss_score = Number(boss_score);
GoobersInvaders.prototype.level_boss_score_increase = Number(level_boss_score_increase);
GoobersInvaders.prototype.num_hits_beat_boss = Number(num_hits_beat_boss);
GoobersInvaders.prototype.level_bonus = Number(level_bonus);
GoobersInvaders.prototype.level_bonus_increase = Number(level_bonus_increase);
GoobersInvaders.prototype.initial_speed = Number(initial_speed);
GoobersInvaders.prototype.hit_speed_increase = Number(hit_speed_increase);
GoobersInvaders.prototype.level_speed_increase = Number(level_speed_increase);
GoobersInvaders.prototype.speed_delay = Number(speed_delay);
GoobersInvaders.prototype.shift_displacement = Number(shift_displacement);
GoobersInvaders.prototype.bottom = Number(bottom);
GoobersInvaders.prototype.num_lives = Number(num_lives);
GoobersInvaders.prototype.num_points_new_life = Number(num_points_new_life);
GoobersInvaders.prototype.player_shot_speed = Number(player_shot_speed);
GoobersInvaders.prototype.enemy_shot_speed = Number(enemy_shot_speed);
GoobersInvaders.prototype.boss_shot_speed = Number(boss_shot_speed);
GoobersInvaders.prototype.enemy_shoot_delay = Number(enemy_shoot_delay);
GoobersInvaders.prototype.enemy_shoot_delay_change = Number(enemy_shoot_delay_change);
GoobersInvaders.prototype.enemy_shoot_delay_minimum = Number(enemy_shoot_delay_minimum);
GoobersInvaders.prototype.quiz_enemy_delay = Number(quiz_enemy_delay);
GoobersInvaders.prototype.quiz_enemy_speed = Number(quiz_enemy_speed);
GoobersInvaders.prototype.correct_points = Number(correct_points);
GoobersInvaders.prototype.incorrect_points = Number(incorrect_points);
GoobersInvaders.prototype.timeline = this;
GoobersInvaders.prototype.load_game_data = function () {
if (this.quiz_data_file == "") {
this.timeline.controller.initialize_next_frame = true;
} else {
this.timeline.controller.loadVariables(this.quiz_data_file);
}
};
GoobersInvaders.prototype.initialize = function () {
this.initialize_variables();
this.initialize_graphics();
this.initialize_level();
};
GoobersInvaders.prototype.initialize_variables = function () {
this._num = new Number();
this.paused = false;
this.depth = 0;
this.score = 0;
this.current_level = 1;
this.current_frame = 1;
this.enemies = new Array();
this.quiz_enemies = new Array();
this.boss = undefined;
this.player_shots = new Array();
this.enemy_shots = new Array();
this.player_lives = this.num_lives;
this.last_shot_time = 0;
this.enemy_direction = 1;
this.last_extra_life_score = 0;
this.play_area = this.timeline.backgrounds.getBounds(this.timeline);
this.wait_for_boss_explosion = false;
this.show_prompt = true;
this.other_level_index = 1;
};
GoobersInvaders.prototype.initialize_graphics = function () {
this.create_player_graphics();
};
GoobersInvaders.prototype.create_player_graphics = function () {
this.timeline.attachMovie("player", "player", ++this.depth);
var _local2 = this.timeline.player;
_local2.cacheAsBitmap = true;
_local2._rotation = this.get_game_rotation();
_local2.invincible = false;
_local2.start_invincible_time = 0;
if (this.direction == "Top to Bottom") {
_local2._x = this.timeline.backgrounds._x + (this.timeline.backgrounds._width / 2);
_local2._y = (this.timeline.backgrounds._y + this.timeline.backgrounds._height) - (_local2._height / 2);
} else if (this.direction == "Bottom to Top") {
_local2._x = this.timeline.backgrounds._x + (this.timeline.backgrounds._width / 2);
_local2._y = this.timeline.backgrounds._y + (_local2._height / 2);
} else if (this.direction == "Left to Right") {
_local2._x = (this.timeline.backgrounds._x + this.timeline.backgrounds._width) - (_local2._width / 2);
_local2._y = this.timeline.backgrounds._y + (this.timeline.backgrounds._height / 2);
} else if (this.direction == "Right to Left") {
_local2._x = this.timeline.backgrounds._x + (_local2._width / 2);
_local2._y = this.timeline.backgrounds._y + (this.timeline.backgrounds._height / 2);
}
};
GoobersInvaders.prototype.get_game_rotation = function () {
if (this.direction == "Top to Bottom") {
return(-90);
}
if (this.direction == "Bottom to Top") {
return(90);
}
if (this.direction == "Left to Right") {
return(180);
}
if (this.direction == "Right to Left") {
return(0);
}
};
GoobersInvaders.prototype.initialize_level = function () {
if (this.current_level != 1) {
this.score = this.score + (this.level_bonus + (this.current_level * this.level_bonus_increase));
}
this.current_frame = 1;
this.paused = true;
this.remove_old_graphics();
this.set_level_background();
if (this.show_prompt) {
this.show_prompt = false;
this.timeline.level_prompt.level = this.other_level_index;
this.timeline.level_prompt.play();
} else {
this.paused = false;
}
this.enemy_type = (((this.current_level % (this.num_levels_boss + 1)) == 0) ? "Boss" : "Regular");
this.create_enemy_graphics();
};
GoobersInvaders.prototype.remove_old_graphics = function () {
var _local4 = this.enemy_shots.length;
var _local2 = 0;
while (_local2 < _local4) {
var _local3 = this.enemy_shots.shift();
_local3._unloadMovie();
_local2++;
}
_local4 = this.player_shots.length;
_local2 = 0;
while (_local2 < _local4) {
var _local3 = this.player_shots.shift();
_local3._unloadMovie();
_local2++;
}
_local4 = this.quiz_enemies.length;
_local2 = 0;
while (_local2 < _local4) {
var _local3 = this.quiz_enemies.shift();
_local3._unloadMovie();
_local2++;
}
};
GoobersInvaders.prototype.set_level_background = function () {
if (this.timeline.backgrounds._currentframe == this.timeline.backgrounds._totalframes) {
this.timeline.backgrounds.gotoAndStop(2);
} else {
this.timeline.backgrounds.nextFrame();
}
};
GoobersInvaders.prototype.create_enemy_graphics = function () {
if (this.enemy_type == "Boss") {
this.create_boss_enemy_graphics();
} else if (this.enemy_type == "Regular") {
this.create_regular_enemy_graphics();
}
};
GoobersInvaders.prototype.create_boss_enemy_graphics = function () {
var _local3 = this._num.randi(0, 3);
this.play_sound("boss_start_sound" + _local3);
this.depth++;
this.timeline.attachMovie("bosses", "boss" + this.depth, this.depth);
this.boss = this.timeline["boss" + this.depth];
this.boss.cacheAsBitmap = true;
this.boss._rotation = this.get_game_rotation() + 180;
var _local2 = Math.floor(this.current_level / (this.num_levels_boss + 1)) - 1;
this.boss.gotoAndStop((_local2 % this.boss._totalframes) + 1);
this.boss.health = this.num_hits_beat_boss;
if (this.direction == "Top to Bottom") {
this.boss._x = this.timeline.backgrounds._x + (this.timeline.backgrounds._width / 2);
this.boss._y = this.timeline.backgrounds._y + (this.boss._height / 2);
} else if (this.direction == "Bottom to Top") {
this.boss._x = this.timeline.backgrounds._x + (this.timeline.backgrounds._width / 2);
this.boss._y = (this.timeline.backgrounds._y + this.timeline.backgrounds._height) - (this.boss._height / 2);
} else if (this.direction == "Left to Right") {
this.boss._x = this.timeline.backgrounds._x + (this.boss._width / 2);
this.boss._y = this.timeline.backgrounds._y + (this.timeline.backgrounds._height / 2);
} else if (this.direction == "Right to Left") {
this.boss._x = (this.timeline.backgrounds._x + this.timeline.backgrounds._width) - (this.boss._width / 2);
this.boss._y = this.timeline.backgrounds._y + (this.timeline.backgrounds._height / 2);
}
this.boss.original_x = this.boss._x;
this.boss.original_y = this.boss._y;
};
GoobersInvaders.prototype.create_regular_enemy_graphics = function () {
this.enemies = new Array();
var _local4 = 0;
while (_local4 < this.num_rows) {
var _local3 = 0;
while (_local3 < this.num_columns) {
this.depth++;
this.timeline.attachMovie("enemies", "enemy" + this.depth, this.depth);
var _local2 = this.timeline["enemy" + this.depth];
_local2.cacheAsBitmap = true;
this.enemies.push(_local2);
_local2._rotation = this.get_game_rotation() + 180;
var _local5 = (this.current_level - 1) - Math.floor(this.current_level / (this.num_levels_boss + 1));
_local2.gotoAndStop((_local5 % _local2._totalframes) + 1);
if (this.direction == "Top to Bottom") {
_local2._x = ((this.timeline.backgrounds._x + (this.timeline.backgrounds._width / 2)) - ((this.num_columns / 2) * (this.enemy_spacing_x + _local2._width))) + ((_local3 + 0.5) * (this.enemy_spacing_x + _local2._width));
_local2._y = (this.timeline.backgrounds._y + (_local2._height / 2)) + (_local4 * (this.enemy_spacing_y + _local2._height));
} else if (this.direction == "Bottom to Top") {
_local2._x = ((this.timeline.backgrounds._x + (this.timeline.backgrounds._width / 2)) - ((this.num_columns / 2) * (this.enemy_spacing_x + _local2._width))) + ((_local3 + 0.5) * (this.enemy_spacing_x + _local2._width));
_local2._y = ((this.timeline.backgrounds._y + this.timeline.backgrounds._height) - (_local2._height / 2)) - (_local4 * (this.enemy_spacing_y + _local2._height));
} else if (this.direction == "Left to Right") {
_local2._x = (this.timeline.backgrounds._x + (_local2._width / 2)) + (_local4 * (this.enemy_spacing_x + _local2._width));
_local2._y = ((this.timeline.backgrounds._y + (this.timeline.backgrounds._height / 2)) - ((this.num_columns / 2) * (this.enemy_spacing_y + _local2._height))) + ((_local3 + 0.5) * (this.enemy_spacing_y + _local2._height));
} else if (this.direction == "Right to Left") {
_local2._x = ((this.timeline.backgrounds._x + this.timeline.backgrounds._width) - (_local2._width / 2)) - (_local4 * (this.enemy_spacing_x + _local2._width));
_local2._y = ((this.timeline.backgrounds._y + (this.timeline.backgrounds._height / 2)) - ((this.num_columns / 2) * (this.enemy_spacing_y + _local2._height))) + ((_local3 + 0.5) * (this.enemy_spacing_y + _local2._height));
}
_local2.original_x = _local2._x;
_local2.original_y = _local2._y;
_local3++;
}
_local4++;
}
};
GoobersInvaders.prototype.render_enemy_graphics = function (enemy_mc) {
var _local2 = (this.current_level - 1) - Math.floor(this.current_level / this.num_levels_boss);
enemy_mc.gotoAndStop((_local2 % enemy_mc._totalframes) + 1);
};
GoobersInvaders.prototype.mouse_down = function () {
if (this.paused) {
return(undefined);
}
if (this.player_control == "Mouse and Click") {
}
};
GoobersInvaders.prototype.key_down = function () {
if (this.paused) {
return(undefined);
}
if (Key.isDown(37) || (Key.isDown(39))) {
this.key_move_player();
}
if (Key.isDown(32)) {
this.player_shoot();
}
};
GoobersInvaders.prototype.player_shoot = function () {
if ((getTimer() - this.last_shot_time) <= 300) {
return(undefined);
}
if (this.timeline.player.invincible) {
return(undefined);
}
this.last_shot_time = getTimer();
this.depth++;
this.timeline.attachMovie("player_shot", "player_shot" + this.depth, this.depth);
var _local2 = this.timeline["player_shot" + this.depth];
_local2.cacheAsBitmap = true;
this.player_shots.push(_local2);
_local2._x = this.timeline.player._x;
_local2._y = this.timeline.player._y;
_local2._rotation = this.get_game_rotation();
var _local3 = 10;
if (this.direction == "Top to Bottom") {
} else if (this.direction == "Bottom to Top") {
} else if (this.direction == "Left to Right") {
this.timeline.player._x = this.timeline.player._x + _local3;
} else if (this.direction == "Right to Left") {
this.timeline.player._x = this.timeline.player._x - _local3;
}
this.timeline.player.play();
};
GoobersInvaders.prototype.action = function () {
if (this.paused) {
return(undefined);
}
if (this.player_control == "Mouse and Click") {
}
this.check_enemy_shoot();
this.move_enemy_shots();
this.check_quiz_enemy();
if ((this.current_frame % this.speed_delay) == 0) {
this.move_enemies();
}
this.move_player_shots();
this.render_player_graphics();
this.update_game_properties();
this.goop_mc._x = this.timeline.player._x;
this.goop_mc._y = this.timeline.player._y;
if (this.wait_for_boss_explosion && (this.big_boss_explosion._currentframe == this.big_boss_explosion._totalframes)) {
this.initialize_level();
this.wait_for_boss_explosion = false;
}
};
GoobersInvaders.prototype.check_quiz_enemy = function () {
if (this.enemy_type == "Boss") {
return(undefined);
}
if ((this.current_frame % this.quiz_enemy_delay) == 0) {
this.create_quiz_enemy();
}
};
GoobersInvaders.prototype.create_quiz_enemy = function () {
this.depth++;
this.timeline.attachMovie("quiz_enemies", "quiz_enemy" + this.depth, this.depth);
var _local2 = this.timeline["quiz_enemy" + this.depth];
_local2.cacheAsBitmap = true;
var _local4 = (this.current_level - 1) - Math.floor(this.current_level / (this.num_levels_boss + 1));
_local2.gotoAndStop((_local4 % _local2._totalframes) + 1);
var _local3 = 350;
if (this.direction == "Top to Bottom") {
_local2.x1 = this.timeline.backgrounds._x;
_local2.y1 = this.timeline.backgrounds._y;
_local2.x2 = this.timeline.player._x;
_local2.y2 = this.timeline.player._y + _local3;
_local2.x3 = this.timeline.backgrounds._x + this.timeline.backgrounds._width;
_local2.y3 = this.timeline.backgrounds._y;
} else if (this.direction == "Bottom to Top") {
_local2.x1 = this.timeline.backgrounds._x;
_local2.y1 = this.timeline.backgrounds._y + this.timeline.backgrounds._height;
_local2.x2 = this.timeline.player._x;
_local2.y2 = this.timeline.player._y - _local3;
_local2.x3 = this.timeline.backgrounds._x + this.timeline.backgrounds._width;
_local2.y3 = this.timeline.backgrounds._y + this.timeline.backgrounds._height;
} else if (this.direction == "Left to Right") {
_local2.x1 = this.timeline.backgrounds._x;
_local2.y1 = this.timeline.backgrounds._y;
_local2.x2 = this.timeline.player._x + _local3;
_local2.y2 = this.timeline.player._y;
_local2.x3 = this.timeline.backgrounds._x;
_local2.y3 = this.timeline.backgrounds._y + this.timeline.backgrounds._height;
} else if (this.direction == "Right to Left") {
_local2.x1 = this.timeline.backgrounds._x + this.timeline.backgrounds._width;
_local2.y1 = this.timeline.backgrounds._y;
_local2.x2 = this.timeline.player._x - _local3;
_local2.y2 = this.timeline.player._y;
_local2.x3 = this.timeline.backgrounds._x + this.timeline.backgrounds._width;
_local2.y3 = this.timeline.backgrounds._y + this.timeline.backgrounds._height;
}
_local2.t = ((Math.random() < 0.5) ? 0 : 1);
_local2.speed = ((_local2.t == 0) ? (this.quiz_enemy_speed) : (-this.quiz_enemy_speed));
this.quiz_enemies.push(_local2);
};
GoobersInvaders.prototype.update_game_properties = function () {
if ((this.score - this.last_extra_life_score) > this.num_points_new_life) {
this.last_extra_life_score = this.score;
this.player_lives++;
}
this.current_frame++;
this.timeline.score = this.score;
_root.score = this.score;
this.timeline.lives = this.player_lives;
};
GoobersInvaders.prototype.check_enemy_shoot = function () {
var _local2 = Math.max(this.enemy_shoot_delay + ((this.current_level - 1) * this.enemy_shoot_delay_change), this.enemy_shoot_delay_minimum);
if ((this.current_frame % _local2) == 0) {
this.enemy_shoot();
}
};
GoobersInvaders.prototype.enemy_shoot = function () {
if (this.enemy_type == "Boss") {
this.shoot_from_enemy(this.boss, "bosses_shots");
} else if (this.enemy_type == "Regular") {
this.shoot_from_enemy(this.enemies.rande(), "enemies_shots");
}
};
var shotNum = 0;
GoobersInvaders.prototype.shoot_from_enemy = function (enemy_mc, shot_linkage) {
this.depth++;
this.timeline.attachMovie(shot_linkage, "shot" + this.depth, this.depth);
var _local2 = this.timeline["shot" + this.depth];
_local2.cacheAsBitmap = true;
this.enemy_shots.push(_local2);
_local2._rotation = this.get_game_rotation() + 180;
_local2._x = enemy_mc._x;
_local2._y = enemy_mc._y;
if (shot_linkage == "enemies_shots") {
var _local3 = (this.current_level - 1) - Math.floor(this.current_level / (this.num_levels_boss + 1));
_local2.gotoAndStop((_local3 % _local2._totalframes) + 1);
} else {
var _local3 = Math.floor(this.current_level / this.num_levels_boss) - 1;
_local2.gotoAndStop((_local3 % _local2._totalframes) + 1);
}
shotNum++;
if (shotNum == 7) {
shotNum = 1;
}
_local2.balloon.gotoAndStop(shotNum);
};
GoobersInvaders.prototype.move_enemy_shots = function () {
var _local4 = this.return_velocity(this.enemy_shot_speed);
var _local2 = 0;
while (_local2 < this.enemy_shots.length) {
var _local3 = this.enemy_shots[_local2];
_local3._x = _local3._x + _local4.x;
_local3._y = _local3._y + _local4.y;
if (!this.timeline.player.invincible) {
this.check_enemy_shot_player_collision(_local3, _local2);
}
this.check_enemy_shot_off_stage(_local3, _local2);
_local2++;
}
};
GoobersInvaders.prototype.check_enemy_shot_player_collision = function (shot_mc, index) {
if (this.timeline.player.hitTest(shot_mc)) {
this.handle_enemy_shot_player_collision(shot_mc, index);
}
};
GoobersInvaders.prototype.handle_enemy_shot_player_collision = function (shot_mc, index) {
var _local2 = ((this.enemy_type == "Boss") ? "boss_shot_explosion" : "enemy_shot_explosion");
this.goop_mc = this.play_explosion_animation(this.timeline.player, _local2);
this.remove_enemy_shot(shot_mc, index);
this.timeline.player.invincible = true;
this.timeline.player.start_invincible_time = getTimer();
this.player_lives--;
this.check_game_over();
};
GoobersInvaders.prototype.check_enemy_shot_off_stage = function (shot_mc, index) {
if ((this.direction == "Top to Bottom") && (shot_mc._y > this.play_area.yMax)) {
this.remove_enemy_shot(shot_mc, index);
} else if ((this.direction == "Bottom to Top") && (shot_mc._y < this.play_area.yMin)) {
this.remove_enemy_shot(shot_mc, index);
} else if ((this.direction == "Left to Right") && (shot_mc._x > this.play_area.xMax)) {
this.remove_enemy_shot(shot_mc, index);
} else if ((this.direction == "Right to Left") && (shot_mc._x < this.play_area.xMin)) {
this.remove_enemy_shot(shot_mc, index);
}
};
GoobersInvaders.prototype.remove_enemy_shot = function (shot_mc, index) {
this.enemy_shots.splice(index, 1);
shot_mc._unloadMovie();
};
GoobersInvaders.prototype.play_explosion_animation = function (obj, linkage) {
this.depth++;
this.timeline.attachMovie(linkage, "explosion" + this.depth, this.depth);
var _local2 = this.timeline["explosion" + this.depth];
_local2.cacheAsBitmap = true;
_local2._x = obj._x;
_local2._y = obj._y;
_local2.gotoAndStop(obj._currentframe);
return(_local2);
};
GoobersInvaders.prototype.move_enemies = function () {
if (this.enemy_type == "Boss") {
this.move_boss_enemy();
} else if (this.enemy_type == "Regular") {
this.move_regular_enemies();
this.move_quiz_enemies();
}
};
GoobersInvaders.prototype.move_quiz_enemies = function () {
var _local4 = 0;
while (_local4 < this.quiz_enemies.length) {
var _local2 = this.quiz_enemies[_local4];
_local2.t = _local2.t + _local2.speed;
var _local3 = _local2.t;
_local2._x = (((_local2.x1 * (1 - _local3)) * (1 - _local3)) + (((2 * _local2.x2) * _local3) * (1 - _local3))) + ((_local2.x3 * _local3) * _local3);
_local2._y = (((_local2.y1 * (1 - _local3)) * (1 - _local3)) + (((2 * _local2.y2) * _local3) * (1 - _local3))) + ((_local2.y3 * _local3) * _local3);
var _local6 = 2 * (((((1 - _local3) * _local2.x1) + _local2.x2) - ((2 * _local3) * _local2.x2)) + (_local3 * _local2.x3));
var _local5 = 2 * (((((1 - _local3) * _local2.y1) + _local2.y2) - ((2 * _local3) * _local2.y2)) + (_local3 * _local2.y3));
_local2._rotation = (Math.atan2(_local5, _local6) * 180) / Math.PI;
if (_local2.speed < 0) {
_local2._rotation = _local2._rotation + 180;
}
if (_local2.hitTest(this.timeline.player)) {
this.quiz_enemies.splice(_local4, 1);
_local2._unloadMovie();
this.goop_mc = this.play_explosion_animation(this.timeline.player, "quiz_enemy_explosion");
this.remove_enemy_shot(shot_mc, index);
this.timeline.player.invincible = true;
this.timeline.player.start_invincible_time = getTimer();
this.player_lives--;
this.check_game_over();
} else if (((_local2.speed > 0) && (_local3 > 1)) || ((_local2.speed < 0) && (_local3 < 0))) {
this.quiz_enemies.splice(_local4, 1);
_local2._unloadMovie();
}
_local4++;
}
};
GoobersInvaders.prototype.move_boss_enemy = function () {
var _local4;
var _local5;
var _local2 = (this.initial_speed + (this.hit_speed_increase * (this.num_hits_beat_boss - this.boss.health))) + (this.current_level * this.level_speed_increase);
var _local3 = this.enemy_direction;
if ((this.direction == "Top to Bottom") || (this.direction == "Bottom to Top")) {
this.boss._x = this.boss._x + (_local2 * this.enemy_direction);
if (((this.boss._x + (this.boss._width / 2)) > this.play_area.xMax) && (this.enemy_direction == 1)) {
this.enemy_direction = this.enemy_direction * -1;
this.boss._x = this.boss._x - ((this.boss._x + (this.boss._width / 2)) - this.play_area.xMax);
} else if (((this.boss._x - (this.boss._width / 2)) < this.play_area.xMin) && (this.enemy_direction == -1)) {
this.enemy_direction = this.enemy_direction * -1;
this.boss._x = this.boss._x - ((this.boss._x - (this.boss._width / 2)) - this.play_area.xMin);
}
} else if ((this.direction == "Left to Right") || (this.direction == "Right to Left")) {
this.boss._y = this.boss._y + (_local2 * this.enemy_direction);
if (((this.boss._y + (this.boss._height / 2)) > this.play_area.yMax) && (this.enemy_direction == 1)) {
this.enemy_direction = this.enemy_direction * -1;
this.boss._y = this.boss._y - ((this.boss._y + (this.boss._height / 2)) - this.play_area.yMax);
} else if (((this.boss._y - (this.boss._height / 2)) < this.play_area.yMin) && (this.enemy_direction == -1)) {
this.enemy_direction = this.enemy_direction * -1;
this.boss._y = this.boss._y - ((this.boss._y - (this.boss._height / 2)) - this.play_area.yMin);
}
}
if (_local3 != this.enemy_direction) {
if (this.direction == "Top to Bottom") {
this.boss._y = this.boss._y + this.shift_displacement;
if (this.boss._y > this.bottom) {
this.boss._x = this.boss.original_x;
this.boss._y = this.boss.original_y;
}
} else if (this.direction == "Bottom to Top") {
this.boss._y = this.boss._y - this.shift_displacement;
if (this.boss._y < this.bottom) {
this.boss._x = this.boss.original_x;
this.boss._y = this.boss.original_y;
}
} else if (this.direction == "Left to Right") {
this.boss._x = this.boss._x + this.shift_displacement;
if (this.boss._x > this.bottom) {
this.boss._x = this.boss.original_x;
this.boss._y = this.boss.original_y;
}
} else if (this.direction == "Right to Left") {
this.boss._x = this.boss._x - this.shift_displacement;
if (this.boss._x < this.bottom) {
this.boss._x = this.boss.original_x;
this.boss._y = this.boss.original_y;
}
}
}
};
GoobersInvaders.prototype.move_regular_enemies = function () {
var _local3;
var _local4;
var _local6 = (this.initial_speed + (this.hit_speed_increase * ((this.num_rows * this.num_columns) - this.enemies.length))) + (this.current_level * this.level_speed_increase);
var _local5 = 0;
while (_local5 < this.enemies.length) {
var _local2 = this.enemies[_local5];
if ((this.direction == "Top to Bottom") || (this.direction == "Bottom to Top")) {
_local2._x = _local2._x + (_local6 * this.enemy_direction);
if (((_local2._x + (_local2._width / 2)) > this.play_area.xMax) && (this.enemy_direction == 1)) {
if (_local3 == undefined) {
_local3 = -1 * this.enemy_direction;
}
if (_local4 == undefined) {
_local4 = (_local2._x + (_local2._width / 2)) - this.play_area.xMax;
}
} else if (((_local2._x - (_local2._width / 2)) < this.play_area.xMin) && (this.enemy_direction == -1)) {
if (_local3 == undefined) {
_local3 = -1 * this.enemy_direction;
}
if (_local4 == undefined) {
_local4 = (_local2._x - (_local2._width / 2)) - this.play_area.xMin;
}
}
} else if ((this.direction == "Left to Right") || (this.direction == "Right to Left")) {
_local2._y = _local2._y + (_local6 * this.enemy_direction);
if (((_local2._y + (_local2._height / 2)) > this.play_area.yMax) && (this.enemy_direction == 1)) {
if (_local3 == undefined) {
_local3 = -1 * this.enemy_direction;
}
if (_local4 == undefined) {
_local4 = (_local2._y + (_local2._height / 2)) - this.play_area.yMax;
}
} else if (((_local2._y - (_local2._height / 2)) < this.play_area.yMin) && (this.enemy_direction == -1)) {
if (_local3 == undefined) {
_local3 = -1 * this.enemy_direction;
}
if (_local4 == undefined) {
_local4 = (_local2._y - (_local2._height / 2)) - this.play_area.yMin;
}
}
}
_local5++;
}
if ((_local3 != undefined) && (_local4 != undefined)) {
this.enemy_direction = _local3;
this.straighten_enemies(_local4);
}
};
GoobersInvaders.prototype.straighten_enemies = function (over_hang) {
var _local4 = false;
var _local3 = 0;
while (_local3 < this.enemies.length) {
var _local2 = this.enemies[_local3];
if ((this.direction == "Top to Bottom") || (this.direction == "Bottom to Top")) {
_local2._x = _local2._x - over_hang;
} else if ((this.direction == "Left to Right") || (this.direction == "Right to Left")) {
_local2._y = _local2._y - over_hang;
}
if (this.direction == "Top to Bottom") {
_local2._y = _local2._y + this.shift_displacement;
if (_local2._y > this.bottom) {
_local4 = true;
}
} else if (this.direction == "Bottom to Top") {
_local2._y = _local2._y - this.shift_displacement;
if (_local2._y < this.bottom) {
_local4 = true;
}
} else if (this.direction == "Left to Right") {
_local2._x = _local2._x + this.shift_displacement;
if (_local2._x > this.bottom) {
_local4 = true;
}
} else if (this.direction == "Right to Left") {
_local2._x = _local2._x - this.shift_displacement;
if (_local2._x < this.bottom) {
_local4 = true;
}
}
_local3++;
}
if (_local4) {
this.reset_enemies();
}
};
GoobersInvaders.prototype.reset_enemies = function () {
var _local2 = 0;
while (_local2 < this.enemies.length) {
this.enemies[_local2]._x = this.enemies[_local2].original_x;
this.enemies[_local2]._y = this.enemies[_local2].original_y;
_local2++;
}
this.timeline.player.invincible = true;
this.timeline.player.start_invincible_time = getTimer();
this.player_lives--;
this.play_sound("enemies_reset_sound");
this.check_game_over();
};
GoobersInvaders.prototype.move_player_shots = function () {
var _local5 = this.return_velocity(this.player_shot_speed);
_local5.x = _local5.x * -2;
_local5.y = _local5.y * -2;
var _local2 = 0;
while (_local2 < this.player_shots.length) {
var _local3 = this.player_shots[_local2];
_local3._x = _local3._x + _local5.x;
_local3._y = _local3._y + _local5.y;
if (this.enemy_type == "Boss") {
var _local4 = this.check_player_shot_boss_collision(_local3, _local2);
if (_local4) {
return(undefined);
}
} else {
var _local4 = this.check_player_shot_enemy_collision(_local3, _local2);
if (_local4) {
return(undefined);
}
}
var _local4 = this.check_player_shot_off_stage(_local3, _local2);
if (_local4) {
return(undefined);
}
_local2++;
}
};
GoobersInvaders.prototype.check_player_shot_boss_collision = function (shot_mc, index) {
if (this.boss.hitTest(shot_mc._x, shot_mc._y, true)) {
this.handle_player_shot_boss_collision(shot_mc, index);
return(true);
}
};
GoobersInvaders.prototype.handle_player_shot_boss_collision = function (shot_mc, index) {
this.boss.health--;
this.boss._mc.gotoAndStop(Math.floor(((this.num_hits_beat_boss - this.boss.health) / this.num_hits_beat_boss) * this.boss._mc._totalframes) + 1);
this.play_explosion_animation(shot_mc, "small_boss_explosions");
this.player_shots.splice(index, 1);
shot_mc._unloadMovie();
if (this.boss.health <= 0) {
this.score = this.score + (this.boss_score + (this.current_level * this.level_boss_score_increase));
this.big_boss_explosion = this.play_explosion_animation(this.boss, "big_boss_explosions");
this.boss._unloadMovie();
this.boss = undefined;
this.current_level++;
this.show_prompt = true;
this.other_level_index++;
this.wait_for_boss_explosion = true;
}
};
GoobersInvaders.prototype.check_player_shot_enemy_collision = function (shot_mc, index) {
var _local2 = 0;
while (_local2 < this.enemies.length) {
var _local3 = this.enemies[_local2];
if (_local3.hitTest(shot_mc)) {
this.handle_player_shot_enemy_collision(shot_mc, index, _local3, _local2);
return(true);
}
_local2++;
}
_local2 = 0;
while (_local2 < this.quiz_enemies.length) {
var _local3 = this.quiz_enemies[_local2];
if (_local3.hitTest(shot_mc)) {
this.play_explosion_animation(_local3, "quiz_enemy_explosions");
this.player_shots.splice(shot_index, 1);
shot_mc._unloadMovie();
this.quiz_enemies.splice(enemy_index, 1);
_local3._unloadMovie();
this.score = this.score + (100 + (this.current_level * 25));
if (this.quiz_data_file != "") {
this.create_quiz();
}
return(true);
}
_local2++;
}
};
GoobersInvaders.prototype.create_quiz = function () {
this.paused = true;
var _local3 = this.questions.pop();
this.questions.unshift(_local3);
this.timeline.quiz_prompt.play();
this.timeline.quiz_prompt.question = _local3.text;
var _local2 = 0;
while (_local2 < this.num_choices_per_question) {
this.timeline.quiz_prompt["choice" + _local2].index = String.fromCharCode(65 + _local2);
this.timeline.quiz_prompt["choice" + _local2].field = _local3.choices[_local2];
this.timeline.quiz_prompt["choice" + _local2].answer = _local2 == _local3.answer;
_local2++;
}
};
GoobersInvaders.prototype.handle_player_shot_enemy_collision = function (shot_mc, shot_index, enemy_mc, enemy_index) {
this.play_explosion_animation(enemy_mc, "enemy_explosions");
this.player_shots.splice(shot_index, 1);
shot_mc._unloadMovie();
this.enemies.splice(enemy_index, 1);
enemy_mc._unloadMovie();
this.score = this.score + (this.enemy_score + (this.current_level * this.level_enemy_score_increase));
this.check_next_level();
};
GoobersInvaders.prototype.check_next_level = function () {
if (this.enemies.length == 0) {
this.current_level++;
this.initialize_level();
}
};
GoobersInvaders.prototype.check_player_shot_off_stage = function (shot_mc, index) {
if (((((this.direction == "Top to Bottom") && (shot_mc._y < this.play_area.yMin)) || ((this.direction == "Bottom to Top") && (shot_mc._y > this.play_area.yMax))) || ((this.direction == "Left to Right") && (shot_mc._x < this.play_area.xMin))) || ((this.direction == "Right to Left") && (shot_mc._x > this.play_area.xMax))) {
this.player_shots.splice(index, 1);
shot_mc._unloadMovie();
}
};
GoobersInvaders.prototype.mouse_move_player = function () {
var _local3 = this.timeline.player;
var _local4 = {x:_root._xmouse, y:_root._ymouse};
this.timeline.globalToLocal(_local4);
_local3._x = _local3._x + ((_local4.x - _local3._x) / 3);
_local3._y = _local3._y + ((_local4.y - _local3._y) / 3);
this.clip_player();
};
GoobersInvaders.prototype.key_move_player = function () {
var _local2 = 15;
var _local3 = this.timeline.player;
_local3._x = _local3._x + ((Key.isDown(39) * _local2) - (Key.isDown(37) * _local2));
_local3._y = _local3._y + ((Key.isDown(40) * _local2) - (Key.isDown(38) * _local2));
this.clip_player();
};
GoobersInvaders.prototype.clip_player = function () {
var _local2 = this.timeline.player;
if (this.direction == "Top to Bottom") {
_local2._x = Math.max(Math.min(_local2._x, this.play_area.xMax - (_local2._width / 2)), this.play_area.xMin + (_local2._width / 2));
_local2._y = this.play_area.yMax - (_local2._height / 2);
} else if (this.direction == "Bottom to Top") {
_local2._x = Math.max(Math.min(_local2._x, this.play_area.xMax - (_local2._width / 2)), this.play_area.xMin + (_local2._width / 2));
_local2._y = this.play_area.yMin + (_local2._height / 2);
} else if (this.direction == "Left to Right") {
_local2._x = this.play_area.xMax - (_local2._width / 2);
_local2._y = Math.max(Math.min(_local2._y, this.play_area.yMax - (_local2._height / 2)), this.play_area.yMin + (_local2._height / 2));
} else if (this.direction == "Right to Left") {
_local2._x = this.play_area.xMin + (_local2._width / 2);
_local2._y = Math.max(Math.min(_local2._y, this.play_area.yMax - (_local2._height / 2)), this.play_area.yMin + (_local2._height / 2));
}
};
GoobersInvaders.prototype.return_velocity = function (speed) {
var _local2 = this.return_direction_flow();
return({x:_local2.x * speed, y:_local2.y * speed});
};
GoobersInvaders.prototype.return_direction_flow = function () {
if (this.direction == "Top to Bottom") {
return({x:0, y:1});
}
if (this.direction == "Bottom to Top") {
return({x:0, y:-1});
}
if (this.direction == "Left to Right") {
return({x:1, y:0});
}
if (this.direction == "Right to Left") {
return({x:-1, y:0});
}
};
GoobersInvaders.prototype.render_player_graphics = function () {
if (this.timeline.player.invincible) {
if ((this.current_frame % 3) == 0) {
this.timeline.player._visible = this.timeline.player._visible ^ true;
}
if ((getTimer() - this.timeline.player.start_invincible_time) >= 2000) {
this.timeline.player.invincible = false;
}
} else {
this.timeline.player._visible = true;
}
};
GoobersInvaders.prototype.check_game_over = function () {
if (this.player_lives <= 0) {
this.timeline._parent.gotoAndStop("Game Over");
}
};
GoobersInvaders.prototype.evaluate_answer = function (choice_mc) {
if (choice_mc.answer) {
this.correct_answer();
} else {
this.incorrect_answer();
}
};
GoobersInvaders.prototype.correct_answer = function () {
this.timeline.quiz_prompt.gotoAndPlay("Correct");
this.score = this.score + this.correct_points;
this.player_lives++;
};
GoobersInvaders.prototype.incorrect_answer = function () {
this.timeline.quiz_prompt.gotoAndPlay("Incorrect");
this.score = this.score + this.incorrect_points;
};
GoobersInvaders.prototype.answer_prompt_done = function () {
this.paused = false;
};
GoobersInvaders.prototype.play_sound = function (linkage) {
this.timeline.sound_mc.gotoAndStop(linkage);
this.timeline.sound_mc.gotoAndStop(1);
};
this._x = 0;
this._y = 0;
game = new GoobersInvaders();
_root._quality = "MEDIUM";
Instance of Symbol 731 MovieClip "controller" in Symbol 792 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
this.key_down = false;
}
onClipEvent (data) {
_parent.game.num_choices_per_question = Number(num_choices_per_question);
_parent.game.questions = new Array();
var j = 0;
while (j >= 0) {
if (this[("question" + j) + "_text"] == undefined) {
break;
}
_parent.game.questions[j] = new Object();
_parent.game.questions[j].text = this[("question" + j) + "_text"];
_parent.game.questions[j].answer = Number(this[("question" + j) + "_answer"]);
_parent.game.questions[j].choices = new Array();
var k = 0;
while (k < _parent.game.num_choices_per_question) {
_parent.game.questions[j].choices[k] = this[(("question" + j) + "_choice") + k];
k++;
}
j++;
}
if (_parent.game.shuffle_questions == "True") {
_parent.game.questions.shuffle();
}
_parent.game.initialize();
}
onClipEvent (mouseDown) {
_parent.game.mouse_down();
}
onClipEvent (keyDown) {
this.key_down = true;
}
onClipEvent (keyUp) {
if (!Key.isDown(32)) {
this.key_down = false;
}
}
onClipEvent (enterFrame) {
if (this.initialize_next_frame) {
_parent.game.initialize();
this.initialize_next_frame = false;
}
if (this.key_down) {
_parent.game.key_down();
}
_parent.game.action();
}
Instance of Symbol 741 MovieClip "level_prompt" in Symbol 792 MovieClip Frame 1
onClipEvent (load) {
this.swapDepths(16001);
}
Instance of Symbol 772 MovieClip "quiz_prompt" in Symbol 792 MovieClip Frame 1
onClipEvent (load) {
this.swapDepths(16005);
}
Symbol 800 Button
on (press) {
this.gotoAndStop("Starting Screen");
}