home *** CD-ROM | disk | FTP | other *** search
- this.stop();
- init = function()
- {
- stop_area = 50;
- control_player_num = 3;
- last_control_player = 0;
- create_max_itemnum = 6;
- total_num = 1;
- item_time = 0;
- item_delay = 30;
- item_min_depth = 1000;
- item_max_depth = 1100;
- item_depth = item_min_depth;
- create_item_num = 0;
- spetial_item = 80;
- color_star = 10;
- life_item = 3;
- hurdle_time = 0;
- hurdle_delay = 384;
- hurdle_move_ok = false;
- hurdle_speed = 8;
- level = 1;
- score = 0;
- life = 3;
- maxLife = 3;
- playerPos1 = 174;
- playerPos2 = 112;
- playerPos3 = 50;
- clicktime = 0;
- minusTime = 0.1;
- plusTime = 3;
- clearTime = 1440;
- distTime = 0;
- startDist = -120;
- clearDist = 283;
- var _loc2_ = 1;
- while(_loc2_ <= control_player_num)
- {
- this["player" + _loc2_].select_mc.gotoAndStop("unactive");
- _loc2_ = _loc2_ + 1;
- }
- menuDepth = menu_mc.getDepth();
- menu_mc.swapDepths(99999);
- textDepth = text_mc.getDepth();
- text_mc.swapDepths(100000);
- pauseDepth = pause_window.getDepth();
- pause_window.swapDepths(100001);
- mouseDepth = mouse_mc.getDepth();
- mouse_mc.swapDepths(100002);
- readyAllPlayer();
- countLevel("s",level);
- text_mc.gotoAndPlay("start");
- };
- init();
- countScore = function(s, num)
- {
- var _loc2_ = 1;
- while(_loc2_ <= 6)
- {
- this.menu_mc.score_mc[s + _loc2_].gotoAndStop(Math.floor(num / Math.pow(10,_loc2_ - 1)) % 10 + 1);
- _loc2_ = _loc2_ + 1;
- }
- };
- countCombo = function(s, num)
- {
- var _loc1_ = 1;
- while(_loc1_ <= 2)
- {
- s.mc["s" + _loc1_].gotoAndStop(Math.floor(num / Math.pow(10,_loc1_ - 1)) % 10 + 1);
- _loc1_ = _loc1_ + 1;
- }
- };
- countLevel = function(s, num)
- {
- var _loc2_ = 1;
- while(_loc2_ <= 2)
- {
- this.menu_mc.level_mc["s" + _loc2_].gotoAndStop(Math.floor(num / Math.pow(10,_loc2_ - 1)) % 10 + 1);
- _loc2_ = _loc2_ + 1;
- }
- };
- playBg = function()
- {
- var _loc2_ = 1;
- while(_loc2_ <= 2)
- {
- if(this["bg" + _loc2_]._currentframe < this["bg" + _loc2_]._totalframes)
- {
- this["bg" + _loc2_].nextFrame();
- }
- else
- {
- this["bg" + _loc2_].gotoAndStop(1);
- }
- _loc2_ = _loc2_ + 1;
- }
- };
- startGame = function()
- {
- game_ok = true;
- action_ok = true;
- distTime = 0;
- hurdle_time = 0;
- create_item_num = 0;
- hurdle_move_ok = false;
- menu_mc.dist_mc._x = startDist;
- removeAllItems();
- initAllPlayer();
- countLevel("s",level);
- };
- this.onEnterFrame = function()
- {
- if(game_ok)
- {
- moveDist();
- createItems();
- moveItems();
- catchItems();
- checkHurdle();
- if(hurdle_move_ok)
- {
- moveHurdle();
- }
- decreaseTime();
- movePlayer();
- playBg();
- }
- };
- moveDist = function()
- {
- if(distTime >= clearTime)
- {
- clearGame();
- }
- distTime++;
- menu_mc.dist_mc._x = startDist + clearDist * (distTime / clearTime);
- };
- pauseGame = function()
- {
- game_ok = false;
- pause_window.nextFrame();
- SoundObj.setVolume(0);
- };
- continueGame = function()
- {
- if(life > 0 && distTime < clearTime)
- {
- game_ok = true;
- }
- if(vol == 1)
- {
- SoundObj.setVolume(100);
- }
- pause_window.prevFrame();
- };
- clearGame = function()
- {
- game_ok = false;
- level++;
- if(item_delay > 10)
- {
- item_delay -= 4;
- }
- if(hurdle_delay > 240)
- {
- hurdle_delay -= 12;
- }
- minusTime *= 1.2;
- if(minusTime > 0.5)
- {
- minusTime = 0.5;
- }
- var _loc2_ = 1;
- while(_loc2_ <= control_player_num)
- {
- this["player" + _loc2_].stopDrag();
- this["player" + _loc2_].gotoAndStop("clear");
- this["player" + _loc2_].select_mc.gotoAndStop("unactive");
- _loc2_ = _loc2_ + 1;
- }
- text_mc.gotoAndStop("levelup");
- };
- stopGame = function()
- {
- game_ok = false;
- removeAllItems();
- var _loc2_ = 1;
- while(_loc2_ <= control_player_num)
- {
- this["player" + _loc2_].stopDrag();
- this["player" + _loc2_].gotoAndStop("gameover");
- this["player" + _loc2_].select_mc.gotoAndStop("unactive");
- _loc2_ = _loc2_ + 1;
- }
- menu_mc.swapDepths(menuDepth);
- text_mc.swapDepths(textDepth);
- pause_window.swapDepths(pauseDepth);
- mouse_mc.swapDepths(mouseDepth);
- text_mc.gotoAndStop("gameover");
- };
- nextGame = function()
- {
- readyAllPlayer();
- removeAllItems();
- menu_mc.time.bar._xscale = 100;
- menu_mc.dist_mc._x = startDist;
- countLevel("s",level);
- text_mc.gotoAndStop("start");
- };
- decreaseTime = function()
- {
- menu_mc.time.bar._xscale -= minusTime;
- if(menu_mc.time.bar._xscale < 0)
- {
- stopGame();
- }
- };
- increaseTime = function(n)
- {
- menu_mc.time.bar._xscale += n;
- };
- increaseMaxTime = function()
- {
- menu_mc.time.bar._xscale = 100;
- };
- decreaseLife = function()
- {
- if(life > 0)
- {
- life--;
- menu_mc.life_mc.gotoAndStop(maxLife - life + 1);
- menu_mc.life_mc.mc.gotoAndPlay(1);
- }
- if(life == 0)
- {
- stopGame();
- }
- };
- increaseLife = function()
- {
- if(life < maxLife)
- {
- life++;
- menu_mc.life_mc.gotoAndStop(maxLife - life + 1);
- }
- };
- createItems = function()
- {
- if(item_time < item_delay)
- {
- item_time++;
- return undefined;
- }
- item_time = 0;
- item.duplicateMovieClip("item" + item_depth,item_depth);
- this["item" + item_depth]._x = Stage.width + random(50);
- var _loc2_ = 2 + 0.3 * level;
- if(_loc2_ > 8)
- {
- _loc2_ = 8;
- }
- this["item" + item_depth].speed = _loc2_ + random(4);
- this["item" + item_depth].gotoAndStop(random(3) + 1);
- if(random(color_star) == 0)
- {
- this["item" + item_depth].mc.gotoAndStop(2);
- }
- else if(random(spetial_item) == 0)
- {
- if(random(life_item) == 0)
- {
- this["item" + item_depth].mc.gotoAndStop(4);
- }
- else
- {
- this["item" + item_depth].mc.gotoAndStop(3);
- }
- }
- else
- {
- this["item" + item_depth].mc.gotoAndStop(1);
- }
- this["item" + item_depth].item_ok = true;
- if(item_depth < item_max_depth)
- {
- item_depth++;
- }
- else
- {
- item_depth = item_min_depth;
- }
- };
- moveItems = function()
- {
- var _loc2_ = item_min_depth;
- while(_loc2_ < item_max_depth)
- {
- if(this["item" + _loc2_].item_ok == true)
- {
- this["item" + _loc2_]._x -= this["item" + _loc2_].speed;
- if(this["item" + _loc2_]._x < -100)
- {
- removeItems(this["item" + _loc2_]);
- }
- }
- _loc2_ = _loc2_ + 1;
- }
- };
- removeItems = function(mc)
- {
- mc.removeMovieClip();
- };
- catchItems = function()
- {
- var _loc4_ = 0;
- var _loc5_ = undefined;
- var _loc2_ = item_min_depth;
- while(_loc2_ < item_max_depth)
- {
- if(this["item" + _loc2_].item_ok == true)
- {
- var _loc3_ = this["item" + _loc2_]._currentframe;
- if(this["item" + _loc2_].hitTest(this["player" + _loc3_].mc.hitarea))
- {
- _loc5_ = _loc3_;
- this["item" + _loc2_].item_ok = false;
- if(this["item" + _loc2_].mc._currentframe == 1)
- {
- score += 1;
- countScore("s",score);
- increaseTime(plusTime);
- _loc4_ = _loc4_ + 1;
- }
- else if(this["item" + _loc2_].mc._currentframe == 2)
- {
- score += 1;
- countScore("s",score);
- increaseTime(plusTime);
- _loc4_ = _loc4_ + 1;
- }
- else if(this["item" + _loc2_].mc._currentframe == 3)
- {
- increaseMaxTime();
- }
- else if(this["item" + _loc2_].mc._currentframe == 4)
- {
- increaseLife();
- }
- this["item" + _loc2_].mc.m.gotoAndPlay(2);
- this["combo" + _loc3_]++;
- }
- }
- _loc2_ = _loc2_ + 1;
- }
- if(_loc4_ >= 2)
- {
- countCombo(this["player" + _loc5_].combo,_loc4_);
- this["player" + _loc5_].combo.gotoAndPlay(2);
- score += 1 * _loc4_;
- countScore("s",score);
- }
- };
- removeAllItems = function()
- {
- var _loc2_ = item_min_depth;
- while(_loc2_ < item_max_depth)
- {
- this["item" + _loc2_].removeMovieClip();
- _loc2_ = _loc2_ + 1;
- }
- hurdle._x = Stage.width + 100;
- };
- readyAllPlayer = function()
- {
- var _loc2_ = 1;
- while(_loc2_ <= control_player_num)
- {
- this["player" + _loc2_].move_ok = false;
- this["player" + _loc2_]._x = this["playerPos" + _loc2_];
- this["player" + _loc2_].gotoAndStop("ready");
- _loc2_ = _loc2_ + 1;
- }
- };
- initAllPlayer = function()
- {
- var _loc2_ = 1;
- while(_loc2_ <= control_player_num)
- {
- initPlayer(this["player" + _loc2_]);
- _loc2_ = _loc2_ + 1;
- }
- };
- initPlayer = function(mc)
- {
- if(game_ok)
- {
- menu_mc.dist_mc.gotoAndStop("go");
- mc.gotoAndStop("go");
- mc.action_ok = true;
- click_ok = true;
- mc.select_mc.gotoAndStop("unactive");
- mc.mc.shadow._visible = true;
- actPlayer(mc.mc);
- }
- else if(life == 0)
- {
- mc.gotoAndStop("gameover");
- }
- };
- jumpPlayer = function(mc)
- {
- if(mc.action_ok == true)
- {
- mc.action_ok = false;
- click_ok = false;
- mc.select_mc.gotoAndStop("unactive");
- var _loc2_ = "jump" + (random(2) + 1);
- mc.gotoAndStop(_loc2_);
- }
- };
- hitPlayer = function(mc)
- {
- menu_mc.dist_mc.gotoAndStop("miss");
- decreaseLife();
- click_ok = false;
- mc.stopDrag();
- mc.select_mc.gotoAndStop("unactive");
- mc.gotoAndStop("miss");
- };
- movePlayer = function()
- {
- var _loc2_ = 1;
- while(_loc2_ <= control_player_num)
- {
- if(this["player" + _loc2_].move_ok)
- {
- this["player" + _loc2_]._x += (this["player" + _loc2_].back_pos - this["player" + _loc2_]._x) * 0.4;
- if(Math.abs(this["player" + _loc2_].back_pos - this["player" + _loc2_]._x) < 3)
- {
- this["player" + _loc2_]._x = this["player" + _loc2_].back_pos;
- this["player" + _loc2_].move_ok = false;
- }
- }
- _loc2_ = _loc2_ + 1;
- }
- };
- bg2.onPress = function()
- {
- if(game_ok && click_ok)
- {
- if(Number(getTimer() - clicktime) < 400)
- {
- var _loc2_ = 1;
- while(_loc2_ <= control_player_num)
- {
- this._parent["player" + _loc2_].back_pos = this._parent["playerPos" + _loc2_];
- this._parent["player" + _loc2_].move_ok = true;
- _loc2_ = _loc2_ + 1;
- }
- }
- else
- {
- clicktime = getTimer();
- }
- }
- };
- resetPosition = function()
- {
- };
- checkDupPlayer = function()
- {
- };
- moveDupPlayer = function(mc)
- {
- };
- actPlayer = function(mc)
- {
- mc.ctrlarea.onPress = function()
- {
- mc._parent.move_ok = false;
- mc._parent.startDrag(false,stop_area,mc._parent._y,Stage.width - stop_area,mc._parent._y);
- };
- mc.ctrlarea.onRelease = function()
- {
- mc._parent.stopDrag();
- jumpPlayer(mc._parent);
- };
- mc.ctrlarea.onReleaseOutside = function()
- {
- mc._parent.stopDrag();
- mc._parent._parent.mouse_mc.prevFrame();
- jumpPlayer(mc._parent);
- };
- mc.ctrlarea.onRollOver = function()
- {
- mc.shadow._visible = false;
- mc._parent.select_mc.gotoAndStop("active");
- };
- mc.ctrlarea.onRollOut = function()
- {
- mc.shadow._visible = true;
- mc._parent.select_mc.gotoAndStop("unactive");
- };
- };
- checkHurdle = function()
- {
- if(hurdle_time < hurdle_delay)
- {
- hurdle_time++;
- return undefined;
- }
- hurdle_time = 0;
- showWarning();
- };
- showWarning = function()
- {
- warning.gotoAndPlay(2);
- };
- createHurdle = function()
- {
- hurdle.gotoAndStop(random(3) + 1);
- hurdle_move_ok = true;
- };
- moveHurdle = function()
- {
- hurdle._x -= hurdle_speed;
- if(hurdle._x < -100)
- {
- hurdle_move_ok = false;
- hurdle._x = Stage.width + 100;
- }
- var _loc2_ = 1;
- while(_loc2_ <= control_player_num)
- {
- if(hurdle.hitarea.hitTest(this["player" + _loc2_].mc.lowhit))
- {
- hitPlayer(this["player" + _loc2_]);
- }
- _loc2_ = _loc2_ + 1;
- }
- };
-