Instance of Symbol 150 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 127
this.stop();
Frame 128
this.stop();
Instance of Symbol 135 MovieClip [BasketballGameSymbol] in Frame 128
//component parameters
onClipEvent (construct) {
num_goals_next_level = 10;
num_goals_next_level_increase = 1;
level_time = 45000;
basket_speed = 3;
basket_speed_increase = 0.5;
basket_left = 100;
basket_right = 525;
score_area_size = 60;
score_area_size_decrease = 2;
reg_basket_score = 2;
reg_basket_score_increase = 1;
bonus_basket_score = 3;
bonus_basket_score_increase = 1;
}
Frame 129
this.stop();
Symbol 34 MovieClip Frame 1
this.stop();
Instance of Symbol 22 MovieClip "highlight" in Symbol 34 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 45 MovieClip Frame 15
this.stop();
this._parent.check_made_basket();
Symbol 52 MovieClip Frame 1
this.stop();
Symbol 52 MovieClip Frame 8
this._parent._parent.shoot_bball();
Symbol 59 MovieClip Frame 1
this.stop();
Symbol 59 MovieClip Frame 7
this._parent._parent.shoot_bball();
Symbol 66 MovieClip Frame 1
this.stop();
Symbol 66 MovieClip Frame 6
this._parent._parent.shoot_bball();
Symbol 67 MovieClip Frame 1
this.stop();
Symbol 81 MovieClip Frame 63
this.stop();
Symbol 91 Button
on (press) {
this._parent.level_prompt_play_pressed();
}
Symbol 92 MovieClip Frame 1
this.stop();
Symbol 94 MovieClip Frame 1
this.stop();
Symbol 97 Button
on (press) {
this._parent.play_bonus_round();
this._visible = false;
}
Symbol 102 Button
on (press) {
this._parent.mode = "regular";
this._parent.initialize_level();
this._visible = false;
}
Symbol 108 Button
on (press) {
_parent._parent.game.evaluate_answer(this);
}
Symbol 134 MovieClip Frame 1
stop();
Symbol 134 MovieClip Frame 20
stop();
Symbol 134 MovieClip Frame 79
_parent.game.answer_prompt_done();
this.gotoAndStop(1);
Symbol 134 MovieClip Frame 138
_parent.game.answer_prompt_done();
this.gotoAndStop(1);
Symbol 135 MovieClip [BasketballGameSymbol] Frame 1
#initclip 1
_global.randi = function (a, b) {
return(Math.floor(Math.random() * (b - a)) + Math.floor(a));
};
Array.prototype.swap = function (a, b) {
var _local2 = this[a];
this[a] = this[b];
this[b] = _local2;
};
Array.prototype.shuffle = function () {
var _local3 = 0;
while (_local3 < this.length) {
this.swap(_local3, _global.randi(0, this.length));
_local3++;
}
};
BasketballGame = function () {
this.change_mode("loading");
this.initialize();
};
BasketballGame.prototype = new MovieClip();
Object.registerClass("BasketballGameSymbol", BasketballGame);
BasketballGame.prototype.initialize = function () {
this.initialize_variables();
this.initialize_level();
};
BasketballGame.prototype.initialize_variables = function () {
this.starting_bonus_time = 5000;
this.mode = "regular";
this.paused = true;
this.basket_dir = 1;
this.level = 0;
this.score = 0;
this.depth = 0;
};
BasketballGame.prototype.initialize_level = function () {
this.num_made_baskets = 0;
this.num_missed_baskets = 0;
this.num_baskets_needed = this.num_goals_next_level + (this.level * this.num_goals_next_level_increase);
this.player.gotoAndStop((this.level % 3) + 1);
for (var _local3 in this.level_prompt) {
this.level_prompt[_local3].gotoAndPlay(1);
}
this.level_prompt.level_txt.text = "Level " + (this.level + 1);
this.level_prompt._visible = true;
this.level_prompt.gotoAndStop((this.level % 3) + 1);
this.level_prompt.instructions.htmlText = ((((("Make at least <font color='#FF0000'><b>" + this.num_baskets_needed) + "</b></font> baskets before time runs out to go to the next level. You will receive <font color='#FF0000'><b>") + (this.reg_basket_score + (this.level * this.reg_basket_score_increase))) + "</b></font> point for each basket and <font color='#FF0000'><b>") + (this.bonus_basket_score + (this.level * this.bonus_basket_score_increase))) + "</b></font> points for each additional basket.";
this.level_start_time = getTimer();
this.pause_game();
this.update_displays();
this.player._x = -500;
this.passed_10secs = false;
this.next_positive = _global.randi(1, 4);
this.next_negative = _global.randi(3, 6);
this.num_positive_played = 0;
this.num_negative_played = 0;
this.positive = ["positive_comment_1", "positive_comment_2", "positive_comment_3", "positive_comment_4", "positive_comment_5", "positive_comment_6"];
this.negative = ["negative_comment_1", "negative_comment_2", "negative_comment_3"];
this.positive.shuffle();
this.negative.shuffle();
this.playing_sound = false;
this.sound_playing = false;
this.min_sound_diff_time = 6000;
this.last_sound_finish_time = getTimer();
};
BasketballGame.prototype.onMouseDown = function () {
if (this.before_bonus_prompt._visible || (this.after_bonus_prompt._visible)) {
return(undefined);
}
if (this.paused) {
return(undefined);
}
if (this.player._mc._currentframe == 1) {
this.player._mc.play();
}
};
BasketballGame.prototype.shoot_bball = function () {
this.bball._x = this.player._x;
this.bball._y = this.player._y;
this.bball.play();
};
BasketballGame.prototype.onEnterFrame = function () {
if (this.game_mode != "play") {
return(undefined);
}
this.score_txt.text = this.score;
_root.score = this.score;
if (this.paused) {
this.player._x = -500;
return(undefined);
}
if (this.mode == "regular") {
this.update_displays();
this.move_basket();
this.move_player();
this.check_passed_10secs();
} else {
var _local5 = getTimer() - this.bonus_shot_start;
var _local4 = (this.starting_bonus_time - (this.num_bonus_shots_made * 300)) - _local5;
var _local3 = Math.floor(_local4 / 1000) % 60;
var _local6 = Math.floor(_local4 / 60000);
if (String(_local3).length == 1) {
_local3 = "0" + _local3;
}
this.time_txt.text = (_local6 + ":") + _local3;
this.move_player();
if (_local5 >= (this.starting_bonus_time - (this.num_bonus_shots_made * 300))) {
this.mode = "regular";
this.bonus_prompt._visible = false;
this.basket._visible = true;
this.mode = "nothing";
this.after_bonus_prompt._visible = true;
this.after_bonus_prompt.score.text = this.bonus_score;
}
}
if (this.mode == "nothing") {
this.time_txt.text = "";
}
if (this.after_bonus_prompt._visible || (this.before_bonus_prompt._visible)) {
this.time_txt.text = "";
}
};
BasketballGame.prototype.check_passed_10secs = function () {
var _local2 = this.level_time - (getTimer() - this.level_start_time);
if ((this.passed_10secs == false) && (_local2 <= 10000)) {
this.passed_10secs = true;
this.play_sound("out_of_time");
this.three_point_prompt.play();
}
};
BasketballGame.prototype.move_player = function () {
this.player._x = _root._xmouse;
};
BasketballGame.prototype.pause_game = function () {
this.paused = true;
this.pause_time = getTimer();
};
BasketballGame.prototype.unpause_game = function () {
this.paused = false;
this.level_start_time = this.level_start_time + (getTimer() - this.pause_time);
};
BasketballGame.prototype.update_displays = function () {
this.made_baskets_txt.text = this.num_made_baskets;
var _local3 = this.level_time - (getTimer() - this.level_start_time);
var _local2 = Math.floor(_local3 / 1000) % 60;
var _local4 = Math.floor(_local3 / 60000);
if (String(_local2).length == 1) {
_local2 = "0" + _local2;
}
this.time_txt.text = (_local4 + ":") + _local2;
if (_local3 <= 0) {
this.time_ran_out();
}
};
BasketballGame.prototype.time_ran_out = function () {
if (this.num_made_baskets >= this.num_baskets_needed) {
this.level++;
this.num_bonus_shots_made = -1;
this.initialize_bonus_level();
stopAllSounds();
} else {
this.pause_game();
_root.gotoAndStop("Game Over");
}
};
BasketballGame.prototype.move_basket = function () {
this.basket._x = this.basket._x + (this.basket_dir * (this.basket_speed + (this.basket_speed_increase * this.level)));
if (this.basket._x >= this.basket_right) {
this.basket._x = this.basket_right;
this.basket_dir = this.basket_dir * -1;
} else if (this.basket._x <= this.basket_left) {
this.basket._x = this.basket_left;
this.basket_dir = this.basket_dir * -1;
}
this.basket.hit_area._width = this.score_area_size - (this.level * this.score_area_size_decrease);
};
BasketballGame.prototype.check_made_basket = function () {
if (this.mode == "regular") {
var _local3 = this.basket;
} else {
if (this.bonus_prompt.b1.highlight._visible) {
var _local3 = this.bonus_prompt.b1;
}
if (this.bonus_prompt.b2.highlight._visible) {
var _local3 = this.bonus_prompt.b2;
}
if (this.bonus_prompt.b3.highlight._visible) {
var _local3 = this.bonus_prompt.b3;
}
}
var _local5 = this.bball._x + this.bball.end_point._x;
var _local4 = this.bball._y + this.bball.end_point._Y;
if (_local3.hit_area.hitTest(_local5, _local4, true)) {
_local3.play();
if (this.mode == "regular") {
if (this.num_made_baskets < this.num_baskets_needed) {
this.score = this.score + (this.reg_basket_score + (this.level * this.reg_basket_score_increase));
} else {
this.score = this.score + (this.bonus_basket_score + (this.level * this.bonus_basket_score_increase));
}
} else {
if (_local3._name == "b1") {
this.score = this.score + 30;
}
if (_local3._name == "b2") {
this.score = this.score + 50;
}
if (_local3._name == "b3") {
this.score = this.score + 10;
}
if (_local3._name == "b1") {
this.bonus_score = this.bonus_score + 30;
}
if (_local3._name == "b2") {
this.bonus_score = this.bonus_score + 50;
}
if (_local3._name == "b3") {
this.bonus_score = this.bonus_score + 10;
}
}
if (this.passed_10secs) {
this.score = this.score + 1;
}
this.play_sound("make_a_basket");
this.make_basket_sound_callback();
this.try_play_positive_comment();
if (this.mode == "bonus") {
this.play_bonus_round();
}
} else {
if (_local3.hitTest(_local5, _local4, true)) {
this.play_sound("hit_rim" + _global.randi(1, 3));
}
this.try_play_negative_comment();
if (this.mode == "bonus") {
this.bonus_prompt._visible = false;
this.basket._visible = true;
this.mode = "nothing";
this.after_bonus_prompt._visible = true;
this.after_bonus_prompt.score.text = this.bonus_score;
}
}
};
BasketballGame.prototype.try_play_negative_comment = function () {
this.num_missed_baskets++;
if (((this.num_missed_baskets >= this.next_negative) && (!this.playing_sound)) && ((getTimer() - this.last_sound_finish_time) >= this.min_sound_diff_time)) {
this.next_negative = this.next_negative + _global.randi(3, 6);
var _local3 = new Sound();
_local3.attachSound(this.negative[this.num_negative_played % this.negative.length]);
_local3.start(0, 1);
_local3.ref = this;
this.playing_sound = true;
_local3.onSoundComplete = function () {
this.ref.last_sound_finish_time = getTimer();
this.ref.playing_sound = false;
};
this.num_negative_played++;
}
};
BasketballGame.prototype.try_play_positive_comment = function () {
this.num_made_baskets++;
if (((this.num_made_baskets >= this.next_positive) && (!this.playing_sound)) && ((getTimer() - this.last_sound_finish_time) >= this.min_sound_diff_time)) {
this.next_positive = this.next_positive + _global.randi(3, 6);
var _local3 = new Sound();
_local3.attachSound(this.positive[this.num_positive_played % this.positive.length]);
_local3.start(0, 1);
_local3.ref = this;
this.playing_sound = true;
_local3.onSoundComplete = function () {
this.ref.last_sound_finish_time = getTimer();
this.ref.playing_sound = false;
};
this.num_positive_played++;
}
};
BasketballGame.prototype.make_basket_sound_callback = function () {
if (((this.num_made_baskets - 1) % 3) == 0) {
this.play_sound("applause" + _global.randi(1, 4));
}
};
BasketballGame.prototype.play_sound = function (linkage, callback) {
var _local3 = this.createEmptyMovieClip("sound" + this.depth, this.depth++);
var _local2 = new Sound(_local3);
_local2.attachSound(linkage);
_local2.start(0, 1);
if (linkage.indexOf("applause") != -1) {
_local2.setVolume(70);
}
};
BasketballGame.prototype.level_prompt_play_pressed = function () {
this.level_prompt._visible = false;
this.unpause_game();
this.level_start_time = getTimer();
this.change_mode("play");
};
BasketballGame.prototype.play_random_dribble = function () {
this.play_sound("basketball_bounce" + _global.randi(1, 3));
};
BasketballGame.prototype.initialize_bonus_level = function () {
this.level_start_time = Number.MAX_VALUE;
this.before_bonus_prompt._visible = true;
this.basket._visible = false;
this.bonus_prompt._visible = true;
this.bonus_score = 0;
};
BasketballGame.prototype.play_bonus_round = function () {
this.num_bonus_shots_made++;
this.bonus_prompt.b1.highlight._visible = false;
this.bonus_prompt.b2.highlight._visible = false;
this.bonus_prompt.b3.highlight._visible = false;
this.bonus_prompt["b" + _global.randi(1, 4)].highlight._visible = true;
this.mode = "bonus";
this.bonus_shot_start = getTimer();
};
BasketballGame.prototype.change_mode = function (_new_mode) {
this.game_mode = _new_mode;
};
#endinitclip
Instance of Symbol 39 MovieClip "bonus_prompt" in Symbol 135 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 45 MovieClip "bball" in Symbol 135 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this.gotoAndStop(1);
}
Instance of Symbol 99 MovieClip "before_bonus_prompt" in Symbol 135 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 104 MovieClip "after_bonus_prompt" in Symbol 135 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 134 MovieClip "quiz_prompt" in Symbol 135 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this.swapDepths(16005);
}
Symbol 150 MovieClip Frame 1
stop();
Instance of Symbol 149 MovieClip "swfloader" in Symbol 150 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 273 Button
on (press) {
stopAllSounds();
this.play();
}
Symbol 281 Button
on (press) {
this.gotoAndStop("Starting Screen");
}