home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / starisland.swf / scripts / __Packages / illusoft / GameTile009.as < prev    next >
Encoding:
Text File  |  2007-12-10  |  2.6 KB  |  87 lines

  1. class illusoft.GameTile009 extends illusoft.GameTile
  2. {
  3.    var lastTime;
  4.    var levelComplete;
  5.    var dmc;
  6.    var character;
  7.    var dynamicsEngine;
  8.    var Enemy;
  9.    function GameTile009(id, dEngine, character, game, gamemc, nextLevel)
  10.    {
  11.       super(id,dEngine,character,game,gamemc,nextLevel);
  12.       this.lastTime = new Date().getTime();
  13.    }
  14.    function Update(x, y)
  15.    {
  16.       super.Update(x);
  17.       if(!this.levelComplete)
  18.       {
  19.          if(x > 1750 && y < 1420)
  20.          {
  21.             _global.sounds.LoopSound("jetstream",60);
  22.          }
  23.          else
  24.          {
  25.             _global.sounds.FadeVolume("jetstream",false,false);
  26.          }
  27.          if(this.character.dmc.hitTest(this.dmc.snowball.sub.sou))
  28.          {
  29.             _global.sounds.LoopSound("stonemove",80);
  30.          }
  31.          else
  32.          {
  33.             _global.sounds.FadeVolume("stonemove",false,false);
  34.          }
  35.       }
  36.       var _loc4_ = new Date().getTime();
  37.       if(this.character.dmc.hitTest(this.dmc.myHitter))
  38.       {
  39.          this.dmc.myHitter._y = -100;
  40.          this.dmc.snowball.play();
  41.       }
  42.       if(this.dmc.snowball._currentframe == 446)
  43.       {
  44.          trace("start to bridge");
  45.          this.Bridge();
  46.       }
  47.       if(this.character.dmc.hitTest(this.dmc.button1) || this.character.dmc.hitTest(this.dmc.button2))
  48.       {
  49.          this.character.MoveUp(22);
  50.          if(_loc4_ - this.lastTime > 500)
  51.          {
  52.             _global.sounds.PlaySound("boing");
  53.             this.lastTime = _loc4_;
  54.          }
  55.       }
  56.    }
  57.    function Bridge()
  58.    {
  59.       var ca = this.character;
  60.       var _loc2_ = new org.cove.flade.surfaces.CircleTile(this.dmc.snowball._x + this.dmc.snowball.ball._x + this.dmc.snowball.ball.ball._width / 2 - 20,this.dmc.snowball._y + this.dmc.snowball.ball._y + this.dmc.snowball.ball.ball._height / 2 - 20,90,this.dmc);
  61.       _loc2_.onContact = function()
  62.       {
  63.          ca.AllowJump(true);
  64.       };
  65.       this.dynamicsEngine.addSurface(_loc2_);
  66.    }
  67.    function Init()
  68.    {
  69.       super.Init();
  70.       this.Enemy = "p1/p2/p3/snowball.sub.hit1/snowball.sub.hit2/snowball.sub.hit3/snowball.sub.hit4";
  71.       this.dmc.myHitter._visible = false;
  72.       _global.sounds.StartMusic("loop4");
  73.    }
  74.    function Close()
  75.    {
  76.       _global.sounds.FadeVolume("jetstream",false,false);
  77.       _global.sounds.FadeVolume("stonemove",false,false);
  78.       super.Close();
  79.    }
  80.    function LevelComplete()
  81.    {
  82.       this.levelComplete = true;
  83.       _global.sounds.FadeVolume("jetstream",false,false);
  84.       _global.sounds.FadeVolume("stonemove",false,false);
  85.    }
  86. }
  87.