home *** CD-ROM | disk | FTP | other *** search
- function new_ball(x, y, r, s, t)
- {
- var _loc3_ = max_balls;
- var _loc2_ = 0;
- while(_loc2_ < max_balls)
- {
- if(!b_array[_loc2_])
- {
- _loc3_ = _loc2_;
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- if(_loc3_ == max_balls)
- {
- return undefined;
- }
- player.duplicateMovieClip("b" + _loc3_,_loc3_);
- this["b" + _loc3_].gotoAndStop(t + 2);
- this["b" + _loc3_].ghost = t;
- this["b" + _loc3_].number = _loc3_;
- this["b" + _loc3_]._x = x;
- this["b" + _loc3_]._y = y;
- this["b" + _loc3_]._xscale = 100;
- this["b" + _loc3_]._yscale = 100;
- this["b" + _loc3_]._rotation = r;
- if(s > max_speed)
- {
- this["b" + _loc3_].target._y = - speed_step;
- }
- else
- {
- this["b" + _loc3_].target._y = - s;
- }
- cur_balls++;
- b_array[_loc3_] = 1;
- }
- function get_rotation(ba, bb)
- {
- dx = ba._x - bb._x;
- dy = ba._y - bb._y;
- return (- Math.atan2(dx,dy)) / 0.017453292519943295;
- }
- function pop_check(b0)
- {
- if(game_over)
- {
- return undefined;
- }
- var _loc3_ = 0;
- while(_loc3_ < max_balls)
- {
- if(b_array[_loc3_] && b0.number != _loc3_ && !this["b" + _loc3_].ghost)
- {
- x = _root.absloc(this["b" + _loc3_]).x;
- y = _root.absloc(this["b" + _loc3_]).y;
- if(b0.hitTest(x,y,true))
- {
- if(boss_fight)
- {
- r = get_rotation(boss,this["b" + _loc3_]);
- new_ball(this["b" + _loc3_]._x,this["b" + _loc3_]._y,r + 180,max_speed,1);
- }
- else if(cur_balls < max_balls / 2)
- {
- r = get_rotation(b0,this["b" + _loc3_]);
- new_ball(this["b" + _loc3_]._x,this["b" + _loc3_]._y,r + 10,- (this["b" + _loc3_].target._y - 4),1);
- new_ball(this["b" + _loc3_]._x,this["b" + _loc3_]._y,r - 10,- (this["b" + _loc3_].target._y - 4),1);
- }
- explode(this["b" + _loc3_],0);
- }
- }
- _loc3_ = _loc3_ + 1;
- }
- }
- function boss_hit_check(b0)
- {
- if(boss.ghost || game_over)
- {
- return undefined;
- }
- x = _root.absloc(b0).x;
- y = _root.absloc(b0).y;
- if(boss.hitTest(x,y,true))
- {
- if(boss.polarity)
- {
- boss.hp = boss.hp + 1;
- }
- else
- {
- boss.hp--;
- }
- explode(b0,2);
- }
- }
- function death_check()
- {
- var _loc5_ = _root.absloc(player).x;
- var _loc4_ = _root.absloc(player).y;
- var _loc3_ = 0;
- while(_loc3_ < max_balls)
- {
- if(b_array[_loc3_] && this["b" + _loc3_].ghost != 1)
- {
- if(this["b" + _loc3_].hitTest(_loc5_,_loc4_,true))
- {
- die();
- }
- }
- _loc3_ = _loc3_ + 1;
- }
- if(boss_fight)
- {
- if(boss.hitTest(_loc5_,_loc4_,true))
- {
- die();
- }
- if(boss_helper.active && boss_helper.hitTest(_loc5_,_loc4_,true))
- {
- die();
- }
- }
- }
- function continue_popping(b0)
- {
- if(b0._xscale < 100)
- {
- if(b0 == player)
- {
- if(time && !game_over)
- {
- b0._xscale = 100;
- b0._yscale = 100;
- b0.popping = 0;
- b0.gotoAndStop(1);
- }
- else if(!time && game_over)
- {
- b0._visible = 0;
- }
- }
- else
- {
- b_array[b0.number] = 0;
- removeMovieClip(b0);
- cur_balls--;
- }
- combo_reset_check();
- }
- else
- {
- b0._xscale += b0.dp * 10;
- b0._yscale += b0.dp * 10;
- b0.dp = b0.dp - 1;
- pop_check(b0);
- }
- }
- function move_player()
- {
- if(player.popping)
- {
- continue_popping(player);
- }
- else if(Math.abs(_xmouse) < frame._width / 2 && Math.abs(_ymouse) < frame._height / 2)
- {
- if(Math.abs(player._x - _xmouse) < player_speed)
- {
- player._x = _xmouse;
- }
- else if(player._x < _xmouse)
- {
- player._x += player_speed;
- }
- else
- {
- player._x -= player_speed;
- }
- if(Math.abs(player._y - _ymouse) < player_speed)
- {
- player._y = _ymouse;
- }
- else if(player._y < _ymouse)
- {
- player._y += player_speed;
- }
- else
- {
- player._y -= player_speed;
- }
- death_check();
- }
- }
- function res_ball(b0)
- {
- b0.ghost = 0;
- b0.gotoAndStop(2);
- }
- function move_ball(b0)
- {
- b0._x = (_root.absloc(b0.target).x - this._x) * 100 / this._xscale;
- b0._y = (_root.absloc(b0.target).y - this._y) * 100 / this._yscale;
- if(Math.abs(b0._x) > frame._width / 2)
- {
- res_ball(b0);
- b0._x += b0._x >= 0 ? - frame._width : frame._width;
- }
- if(Math.abs(b0._y) > frame._height / 2)
- {
- res_ball(b0);
- b0._y += b0._y >= 0 ? - frame._height : frame._height;
- }
- if(b0.ghost == 1 && boss_fight)
- {
- boss_hit_check(b0);
- }
- }
- function move_all_balls()
- {
- var _loc2_ = 0;
- while(_loc2_ < max_balls)
- {
- if(b_array[_loc2_])
- {
- if(this["b" + _loc2_].popping)
- {
- continue_popping(this["b" + _loc2_]);
- }
- else
- {
- move_ball(this["b" + _loc2_]);
- }
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function start_boss_fight()
- {
- var _loc2_ = 0;
- while(_loc2_ < max_balls)
- {
- if(b_array[_loc2_] && !this["b" + _loc2_].popping)
- {
- explode(this["b" + _loc2_],3);
- }
- _loc2_ = _loc2_ + 1;
- }
- boss_fight = 1;
- }
- function combo_reset_check()
- {
- var _loc3_ = 0;
- var _loc2_ = 0;
- while(_loc2_ < max_balls)
- {
- if(b_array[_loc2_] && this["b" + _loc2_].popping)
- {
- _loc3_ = 1;
- _loc2_ = max_balls;
- }
- _loc2_ = _loc2_ + 1;
- }
- if(!_loc3_)
- {
- combo = 0;
- boss_fight_check();
- }
- }
- function boss_fight_check()
- {
- if(boss_fight)
- {
- return undefined;
- }
- if(score > level * 1000)
- {
- start_boss_fight();
- }
- else if(score > next_star * 1000)
- {
- drop_star = 1;
- time += 300;
- next_star++;
- }
- }
- function die()
- {
- player.popping = 1;
- player.dp = 10;
- player.ghost = 1;
- player.gotoAndStop("pop");
- player.aura.gotoAndStop(2);
- _root.die_sfx.start();
- time -= 300;
- combo++;
- }
- function explode(b0, c)
- {
- if(b0.popping)
- {
- return undefined;
- }
- b0.popping = 1;
- b0.dp = 10;
- b0.ghost = 1;
- b0.gotoAndStop("pop");
- b0.aura.gotoAndStop(c + 1);
- if(c != 3)
- {
- combo++;
- score += combo + level;
- total_score += combo + level;
- if(score > total_stock * total_stock * total_stock)
- {
- time += 150;
- total_stock++;
- _root.bling_sfx.start();
- }
- }
- _root.explode_sfx.start();
- }
- function format_time()
- {
- if(boss_fight != 1)
- {
- time--;
- }
- if(time < 0)
- {
- time = 0;
- if(!player.popping)
- {
- die();
- }
- }
- timef = int(time / 30) + "." + time % 30;
- }
- function level_up()
- {
- score = 0;
- time += 1500;
- level++;
- total_stock = level;
- next_star = 1;
- }
- max_balls = 64;
- cur_balls = 0;
- speed_step = 4;
- max_speed = 16;
- player_speed = 16;
- boss_fight = 0;
- level = 0;
- total_score = 0;
- time = 1500;
- cheatstick = 0;
- drop_star = 0;
- game_over = 0;
- next_star = 1;
- b_array = new Array(max_balls);
- player.stop();
- createEmptyMovieClip("blank",300);
- player.swapDepths("blank");
- removeMovieClip("blank");
-