Instance of Symbol 223 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
this.stop();
Frame 73
this.stop();
Instance of Symbol 207 MovieClip [BasketballGameSymbol] in Frame 73
//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 = 800;
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 74
this.stop();
Symbol 20 MovieClip Frame 1
this.stop();
Instance of Symbol 8 MovieClip "highlight" in Symbol 20 MovieClip Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 63 MovieClip Frame 15
this.stop();
this._parent.check_made_basket();
Symbol 105 MovieClip Frame 1
this.stop();
Symbol 105 MovieClip Frame 8
this._parent._parent.shoot_bball();
Symbol 106 MovieClip Frame 1
this.stop();
Symbol 127 MovieClip Frame 54
this.stop();
Symbol 169 Button
on (press) {
this._parent.level_prompt_play_pressed();
}
Symbol 170 MovieClip Frame 1
this.stop();
Instance of Symbol 159 MovieClip "player" in Symbol 170 MovieClip Frame 1
onClipEvent (enterFrame) {
if (this._parent._visible) {
this.play();
} else {
this.stop();
}
}
Symbol 173 MovieClip Frame 1
this.stop();
Symbol 176 Button
on (press) {
this._parent.play_bonus_round();
this._visible = false;
}
Symbol 181 Button
on (press) {
this._parent.mode = "regular";
this._parent.initialize_level();
this._visible = false;
}
Symbol 204 MovieClip Frame 1
this._visible = false;
this.stop();
Symbol 206 MovieClip Frame 1
this._visible = false;
this.stop();
Symbol 206 MovieClip Frame 70
this.gotoAndStop(1);
Symbol 206 MovieClip Frame 130
this.gotoAndStop(1);
Symbol 206 MovieClip Frame 182
this.gotoAndStop(1);
Symbol 206 MovieClip Frame 272
this.gotoAndStop(1);
Symbol 206 MovieClip Frame 335
this.gotoAndStop(1);
Symbol 206 MovieClip Frame 427
this.gotoAndStop(1);
Symbol 206 MovieClip Frame 473
this.gotoAndStop(1);
Symbol 206 MovieClip Frame 543
this.gotoAndStop(1);
Symbol 206 MovieClip Frame 601
this.gotoAndStop(1);
Symbol 207 MovieClip [BasketballGameSymbol] Frame 1
#initclip 1
Number.prototype.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 = new Number();
var _local2 = 0;
while (_local2 < this.length) {
this.swap(_local2, _local3.randi(0, this.length));
_local2++;
}
};
BasketballGame = function () {
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._num = new Number();
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 _local2 in this.level_prompt) {
this.level_prompt[_local2].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 " + this.num_baskets_needed) + " baskets before time runs out to go to the next level. You will receive ") + (this.reg_basket_score + (this.level * this.reg_basket_score_increase))) + " point for each basket and ") + (this.bonus_basket_score + (this.level * this.bonus_basket_score_increase))) + " points for each additional basket over 10.";
this.level_start_time = getTimer();
this.pause_game();
this.update_displays();
this.player._x = -500;
this.passed_10secs = false;
this.next_positive = this._num.randi(1, 4);
this.next_negative = this._num.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 () {
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 () {
var _local4 = {x:_root._xmouse, y:_root._ymouse};
this.globalToLocal(_local4);
this.player._x = _local4.x;
var _local3 = this.player.getBounds(this);
if (_local3.xMin < (this.background_mc._x - (this.background_mc._width / 2))) {
this.player._x = this.background_mc._x - (this.background_mc._width / 2);
} else if (_local3.xMax > (this.background_mc._x + (this.background_mc._width / 2))) {
this.player._x = (this.background_mc._x + (this.background_mc._width / 2)) - (this.player._width / 2);
}
};
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();
this._parent.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 _local2 = this.basket;
} else {
if (this.bonus_prompt.b1.highlight._visible) {
var _local2 = this.bonus_prompt.b1;
}
if (this.bonus_prompt.b2.highlight._visible) {
var _local2 = this.bonus_prompt.b2;
}
if (this.bonus_prompt.b3.highlight._visible) {
var _local2 = this.bonus_prompt.b3;
}
}
var _local4 = this.bball._x + this.bball.end_point._x;
var _local3 = (this.bball._y + 20) + this.bball.end_point._Y;
if (_local2.hit_area.hitTest(_local4, _local3, true)) {
_local2.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 (_local2._name == "b1") {
this.score = this.score + 30;
}
if (_local2._name == "b2") {
this.score = this.score + 50;
}
if (_local2._name == "b3") {
this.score = this.score + 10;
}
if (_local2._name == "b1") {
this.bonus_score = this.bonus_score + 30;
}
if (_local2._name == "b2") {
this.bonus_score = this.bonus_score + 50;
}
if (_local2._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 (_local2.hitTest(_local4, _local3, true)) {
this.play_sound("hit_rim" + this._num.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.feed_back_sounds._currentframe == 1)) {
this.next_negative = this.next_negative + this._num.randi(3, 6);
this.feed_back_sounds.gotoAndPlay(this.negative[this.num_negative_played % this.negative.length]);
this.num_negative_played++;
}
};
BasketballGame.prototype.try_play_positive_comment = function () {
this.num_made_baskets++;
if ((this.num_made_baskets >= this.next_positive) && (this.feed_back_sounds._currentframe == 1)) {
this.next_positive = this.next_positive + this._num.randi(3, 6);
this.feed_back_sounds.gotoAndPlay(this.positive[this.num_positive_played % this.positive.length]);
this.num_positive_played++;
}
};
BasketballGame.prototype.make_basket_sound_callback = function () {
if (((this.num_made_baskets - 1) % 3) == 0) {
this.play_sound("applause" + this._num.randi(1, 4));
}
};
BasketballGame.prototype.play_sound = function (linkage, callback) {
this.sounds_mc.gotoAndStop(linkage);
this.sounds_mc.gotoAndStop(1);
};
BasketballGame.prototype.level_prompt_play_pressed = function () {
this.level_prompt._visible = false;
this.unpause_game();
};
BasketballGame.prototype.play_random_dribble = function () {
this.play_sound("basketball_bounce" + this._num.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" + this._num.randi(1, 4)].highlight._visible = true;
this.mode = "bonus";
this.bonus_shot_start = getTimer();
};
#endinitclip
Instance of Symbol 25 MovieClip "bonus_prompt" in Symbol 207 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 63 MovieClip "bball" in Symbol 207 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this.gotoAndStop(1);
}
Instance of Symbol 178 MovieClip "before_bonus_prompt" in Symbol 207 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this._visible = false;
}
Instance of Symbol 183 MovieClip "after_bonus_prompt" in Symbol 207 MovieClip [BasketballGameSymbol] Frame 1
onClipEvent (load) {
this._visible = false;
}
Symbol 223 MovieClip Frame 1
stop();
Instance of Symbol 222 MovieClip "swfloader" in Symbol 223 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 238 Button
on (release) {
getURL ("http://www.franktownrocks.com");
}
Symbol 290 Button
on (press) {
stopAllSounds();
this.play();
}
Symbol 298 Button
on (release) {
getURL ("http://www.franktownrocks.com");
}
Symbol 303 Button
on (press) {
this.gotoAndStop("Starting Screen");
}