home *** CD-ROM | disk | FTP | other *** search
- class illusoft.GameTile012 extends illusoft.GameTile
- {
- var lastTime;
- var nt;
- var character;
- var dmc;
- var game;
- var Enemy;
- var dynamicsEngine;
- var impressed = false;
- var StartedAnt0 = false;
- var StartedAnt1 = false;
- var StartedAnt2 = false;
- var StartedAnt4 = false;
- function GameTile012(id, dEngine, character, game, gamemc, nextLevel)
- {
- super(id,dEngine,character,game,gamemc,nextLevel);
- this.lastTime = new Date().getTime();
- }
- function Update(x)
- {
- super.Update(x);
- this.nt = new Date().getTime();
- this.checkJumper();
- if(this.dmc.downer.fblock.red_btn.hitTest(this.character.dmc))
- {
- this.character.dmc._visible = false;
- this.dmc.downer.ch._visible = true;
- this.impressed = true;
- }
- if(this.impressed)
- {
- this.dmc.downer.play();
- this.DoMovie();
- }
- if(!this.StartedAnt0)
- {
- this.startAnts(0);
- }
- if(!this.StartedAnt1)
- {
- this.startAnts(1);
- }
- if(!this.StartedAnt2)
- {
- this.startAnts(2);
- }
- if(!this.StartedAnt4)
- {
- this.startAnts(4);
- }
- this.checkChild(1);
- this.checkChild(2);
- this.FindChild(3);
- this.checkChild(4);
- this.checkChild(0);
- }
- function startAnts(yourAnt)
- {
- var temp = this.dmc + ".Driver" + yourAnt;
- if(this.character.dmc.hitTest(temp))
- {
- switch(yourAnt)
- {
- case 0:
- this.StartedAnt0 = true;
- break;
- case 1:
- this.StartedAnt1 = true;
- break;
- case 2:
- this.StartedAnt2 = true;
- break;
- case 4:
- this.StartedAnt4 = true;
- }
- eval(this.dmc + ".ant" + yourAnt).play();
- }
- }
- function FindChild(mychild)
- {
- var temp = eval(this.dmc + "." + "childChar" + mychild);
- if(this.character.dmc.hitTest(temp) && temp._visible)
- {
- temp._visible = false;
- _global.sounds.PlaySound("bling");
- this.character.FoundChild(temp._name);
- }
- }
- function checkChild(mychild)
- {
- var temp = eval(this.dmc + ".ant" + mychild);
- if(this.character.dmc.hitTest(temp.antbody.ChildBody) && temp.antbody.childCharN._visible)
- {
- _global.sounds.PlaySound("bling");
- this.character.FoundChild(temp._name);
- temp.stop();
- temp.antbody.childCharN._visible = false;
- var i = 0;
- while(i < this.game.arrEnemy.length)
- {
- if(this.game.arrEnemy[i] == "ant" + mychild + ".antbody")
- {
- this.game.DeleteEnemy(i,"die");
- }
- i++;
- }
- }
- }
- function checkJumper()
- {
- if(this.character.dmc.hitTest(this.dmc.button1))
- {
- this.character.MoveUp(30);
- if(this.nt - this.lastTime > 500)
- {
- _global.sounds.PlaySound("boing");
- this.lastTime = this.nt;
- }
- }
- }
- function DoMovie()
- {
- var _loc2_ = this.game.camYSpeed;
- this.game.camYSpeed = 0.5;
- if(this.dmc.downer._currentframe > 5 && this.dmc.downer._currentframe <= 15)
- {
- illusoft.Game.Instance.character.wheelPrimitive.setPos(this.dmc.downer._x + this.dmc.downer.ch._x,this.dmc.downer._y + this.dmc.downer.ch._y);
- }
- if(this.dmc.downer._currentframe == 15)
- {
- this.dmc.downer._visible = false;
- this.character.dmc._visible = true;
- this.game.camYSpeed = _loc2_;
- this.character.KillEnemy();
- this.impressed = false;
- }
- }
- function Init()
- {
- super.Init();
- _global.sounds.StartMusic("loop3");
- this.StartedAnt0 = false;
- this.StartedAnt1 = false;
- this.StartedAnt2 = false;
- this.StartedAnt4 = false;
- this.lastTime = new Date().getTime();
- this.Enemy = "ant1.antbody/ant2.antbody/ant4.antbody/ant0.antbody/";
- var c = new org.cove.flade.surfaces.CircleTile(this.dmc.myCir1._x,this.dmc.myCir1._y,this.dmc.myCir1._width / 2,this.dmc);
- c.onContact = function()
- {
- delete c;
- };
- this.dynamicsEngine.addSurface(c);
- }
- function Close()
- {
- super.Close();
- }
- }
-