home *** CD-ROM | disk | FTP | other *** search
- class illusoft.GameTile013 extends illusoft.GameTile
- {
- var levelComplete;
- var dmc;
- var character;
- var lastTime;
- var myCurrentwindmill;
- var r1;
- var r2;
- var r3;
- var r4;
- var Enemy;
- var gameMC;
- var surfaces;
- var dynamicsEngine;
- var allowedTime = 15;
- var doAttack = false;
- var Duration = 0;
- function GameTile013(id, dEngine, character, game, gamemc, nextLevel)
- {
- super(id,dEngine,character,game,gamemc,nextLevel);
- }
- function Update(x)
- {
- super.Update(x);
- if(!this.levelComplete)
- {
- if(x > 900 && x < 2733 || x > 3600 && x < 5400)
- {
- _global.sounds.LoopSound("fc",100);
- }
- else
- {
- _global.sounds.FadeVolume("fc",false,false);
- }
- if(this.character.dmc.hitTest(this.dmc.bee1.sou) && this.dmc.bee1._visible || this.character.dmc.hitTest(this.dmc.bee2.sou) && this.dmc.bee2._visible || this.character.dmc.hitTest(this.dmc.bee3.sou) && this.dmc.bee3._visible || this.character.dmc.hitTest(this.dmc.bee4.sou) && this.dmc.bee4._visible || this.character.dmc.hitTest(this.dmc.bee5.sou) && this.dmc.bee5._visible || this.character.dmc.hitTest(this.dmc.bee6.sou) && this.dmc.bee6._visible || this.character.dmc.hitTest(this.dmc.bee7.sou) && this.dmc.bee7._visible)
- {
- _global.sounds.LoopSound("bee",100);
- }
- else
- {
- _global.sounds.FadeVolume("bee",false,false);
- }
- }
- var _loc5_ = new Date().getTime();
- if(this.character.dmc.hitTest(this.dmc.mine1))
- {
- this.dmc.mine1.play();
- if(_loc5_ - this.lastTime > 1000)
- {
- _global.sounds.PlaySound("explode");
- this.lastTime = _loc5_;
- }
- this.character.MoveUp(6);
- }
- this.changeWindMill();
- this.r1.ReSet(this.myCurrentwindmill.t1._x / 2 + this.myCurrentwindmill._x,this.myCurrentwindmill.t1._y / 2 + this.myCurrentwindmill._y);
- this.r2.ReSet(this.myCurrentwindmill.t2._x / 2 + this.myCurrentwindmill._x,this.myCurrentwindmill.t2._y / 2 + this.myCurrentwindmill._y);
- this.r3.ReSet(this.myCurrentwindmill.t3._x / 2 + this.myCurrentwindmill._x,this.myCurrentwindmill.t3._y / 2 + this.myCurrentwindmill._y);
- this.r4.ReSet(this.myCurrentwindmill.t4._x / 2 + this.myCurrentwindmill._x,this.myCurrentwindmill.t4._y / 2 + this.myCurrentwindmill._y);
- this.TimeUnderFlower();
- }
- function changeWindMill()
- {
- if(this.character.dmc.hitTest(this.dmc.ranger122))
- {
- this.myCurrentwindmill = this.dmc.cross2;
- }
- if(this.character.dmc.hitTest(this.dmc.ranger223))
- {
- this.myCurrentwindmill = this.dmc.cross3;
- }
- if(this.character.dmc.hitTest(this.dmc.ranger324))
- {
- this.myCurrentwindmill = this.dmc.cross4;
- }
- if(this.character.dmc.hitTest(this.dmc.ranger423))
- {
- this.myCurrentwindmill = this.dmc.cross3;
- }
- if(this.character.dmc.hitTest(this.dmc.ranger322))
- {
- this.myCurrentwindmill = this.dmc.cross2;
- }
- if(this.character.dmc.hitTest(this.dmc.ranger221))
- {
- this.myCurrentwindmill = this.dmc.cross1;
- }
- }
- function TimeUnderFlower()
- {
- var k = false;
- var i = 1;
- while(i < 8)
- {
- if(this.character.dmc.hitTest(this.dmc + ".hitter" + i))
- {
- k = true;
- break;
- }
- i++;
- }
- if(k)
- {
- this.Duration = this.Duration + 1;
- if(this.Duration > this.allowedTime)
- {
- eval(this.dmc + ".bee" + i).gotoAndPlay("beat");
- this.Duration = -60;
- }
- }
- else
- {
- this.Duration = 0;
- }
- }
- function Init()
- {
- super.Init();
- _global.sounds.StartMusic("loop1");
- this.Enemy = "bee1/bee2/bee3/bee4/bee5/bee6/bee7";
- this.lastTime = new Date().getTime();
- this.myCurrentwindmill = this.dmc.cross1;
- var ca = this.character;
- var _loc7_ = this.dmc.cross1._x;
- var _loc6_ = this.dmc.cross1._y;
- var _loc5_ = this.myCurrentwindmill.t1._width / 2;
- var _loc4_ = this.myCurrentwindmill.t1._height / 2;
- this.r1 = new org.cove.flade.surfaces.MoveRectangleTile(0,0,_loc5_,_loc4_,this.gameMC);
- this.r2 = new org.cove.flade.surfaces.MoveRectangleTile(0,0,_loc5_,_loc4_,this.gameMC);
- this.r3 = new org.cove.flade.surfaces.MoveRectangleTile(0,0,_loc5_,_loc4_,this.gameMC);
- this.r4 = new org.cove.flade.surfaces.MoveRectangleTile(0,0,_loc5_,_loc4_,this.gameMC);
- this.r1.onContact = function()
- {
- ca.AllowJump(true);
- };
- this.r2.onContact = this.r3.onContact = this.r4.onContact = this.r1.onContact;
- this.surfaces.push(this.r1);
- this.surfaces.push(this.r2);
- this.surfaces.push(this.r3);
- this.surfaces.push(this.r4);
- this.dynamicsEngine.addSurface(this.r1);
- this.dynamicsEngine.addSurface(this.r2);
- this.dynamicsEngine.addSurface(this.r3);
- this.dynamicsEngine.addSurface(this.r4);
- }
- function Close()
- {
- _global.sounds.FadeVolume("bee",false,false);
- _global.sounds.FadeVolume("fc",false,false);
- super.Close();
- this.surfaces.clear();
- }
- function LevelComplete()
- {
- this.levelComplete = true;
- _global.sounds.FadeVolume("bee",false,false);
- _global.sounds.FadeVolume("fc",false,false);
- }
- }
-