home *** CD-ROM | disk | FTP | other *** search
- function initGames()
- {
- this._visible = true;
- oScene = new com.Scene(this.engine);
- this.onMouseMove = function()
- {
- renderScene();
- };
- maxVolumeSound = 100;
- soundBack = new Sound(sound_mc);
- soundBack.attachSound("soundBackground");
- soundBack.setVolume(0);
- soundBack.start(0,9999);
- soundBack.onSoundComplete = function()
- {
- soundBack.stop();
- soundBack.start(0,9999);
- };
- sound_UP_DOWN(true);
- }
- function sound_UP_DOWN(flag)
- {
- sound_mc.flag = flag;
- sound_mc.onEnterFrame = function()
- {
- var _loc2_ = soundBack.getVolume();
- if(this.flag)
- {
- _loc2_ += 2;
- soundBack.setVolume(_loc2_);
- if(_loc2_ >= maxVolumeSound)
- {
- soundBack.setVolume(maxVolumeSound);
- delete this.enterFrame;
- }
- }
- else
- {
- _loc2_ = _loc2_ - 1;
- soundBack.setVolume(_loc2_);
- if(_loc2_ <= 0)
- {
- soundBack.setVolume(0);
- delete this.enterFrame;
- }
- }
- };
- }
- function startNextLevel()
- {
- _root.level_complete = false;
- this.onMouseMove = function()
- {
- renderScene();
- };
- this.engine._alpha = 0;
- this.engine.useHandCursor = false;
- delete this.engine.onPress;
- oScene.createEngine(level);
- maxLevel = oScene.maxLevel;
- renderScene();
- this.playGame.level_str = "Level: " + level + " of " + maxLevel;
- bonus = level * 100;
- timer = getTimer();
- this.playGame.bonus = bonus;
- this.engine.onEnterFrame = function()
- {
- this._alpha += 5;
- if(this._alpha > 100)
- {
- this._alpha = 100;
- delete this.onEnterFrame;
- this.onEnterFrame = function()
- {
- var _loc2_ = Math.floor((getTimer() - this._parent.timer) / 1000);
- this._parent.playGame.bonus = this._parent.bonus - this._parent.level * _loc2_;
- if(this._parent.playGame.bonus < 0)
- {
- this._parent.playGame.bonus = 0;
- }
- };
- }
- };
- }
- function endLevel()
- {
- delete this.onMouseMove;
- this.engine.onPress = null;
- this.engine.cub_mc_1._visible = this.engine.cub_mc_2._visible = this.engine.cub_mc_3._visible = false;
- var _loc7_ = 1000;
- for(var _loc8_ in this.engine)
- {
- var _loc3_ = this.engine[_loc8_];
- var _loc4_ = _loc3_.getBounds(_loc3_._parent);
- var _loc6_ = (_loc4_.xMin + _loc4_.xMax) / 2;
- var _loc5_ = (_loc4_.yMin + _loc4_.yMax) / 2;
- if(_loc4_.yMin < _loc7_)
- {
- _loc7_ = _loc4_.yMin;
- _root.min_y_cell = _loc3_;
- }
- _loc3_.f_dx = _loc6_ / 30;
- _loc3_.f_dy = - Math.abs(_loc5_ / 15) - Math.random() * 5;
- _loc3_.fddy = 1.1 + Math.random() * 0.2 - 0.1;
- }
- _root.level_complete = true;
- _root.score += level * 100 + this.playGame.bonus;
- this.engine.onEnterFrame = function()
- {
- for(var _loc4_ in this)
- {
- var _loc3_ = this[_loc4_];
- _loc3_._x += _loc3_.f_dx;
- _loc3_._y += _loc3_.f_dy;
- _loc3_._rotation += _loc3_.f_dx / 5;
- _loc3_.f_dy += _loc3_.fddy;
- if(_root.min_y_cell._y > 790)
- {
- this._alpha = 0;
- delete this.onEnterFrame;
- if(this.flag)
- {
- startNextLevel();
- }
- else
- {
- youWin();
- }
- }
- }
- };
- level++;
- if(level > maxLevel)
- {
- level = 1;
- this.engine.flag = false;
- menu.dataSave.data.level = undefined;
- menu.dataSave.flush();
- }
- else
- {
- this.engine.flag = true;
- if(menu.dataSave.data.level < level || menu.dataSave.data.level == undefined)
- {
- menu.dataSave.data.level = level;
- }
- }
- }
- function youWin()
- {
- this.menu.youWin_mc._visible = true;
- this.playGame.endGames();
- }
- function renderScene()
- {
- var _loc2_ = -135 + (- this.engine._ymouse) / dec;
- if(_loc2_ > -90)
- {
- _loc2_ = -90;
- }
- else if(_loc2_ < -180)
- {
- _loc2_ = -180;
- }
- var _loc3_ = -135 + (- this.engine._xmouse) / dec;
- if(_loc3_ > -90)
- {
- _loc3_ = -90;
- }
- else if(_loc3_ < -180)
- {
- _loc3_ = -180;
- }
- oScene.render(_loc2_,_loc3_);
- }
- stop();
- Stage.scaleMode = "noScale";
- var maxLevel;
- var dec = 3.5;
- var level = 1;
- this._visible = false;
- initGames();
- stop();
-