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

  1. class illusoft.GameTile008 extends illusoft.GameTile
  2. {
  3.    var levelComplete;
  4.    var dmc;
  5.    var character;
  6.    var r1;
  7.    var r2;
  8.    var r3;
  9.    var r4;
  10.    var r5;
  11.    var r0;
  12.    var dynamicsEngine;
  13.    var game;
  14.    var gameMC;
  15.    var surfaces;
  16.    var StartRunHide;
  17.    var Enemy;
  18.    var b2;
  19.    var b1;
  20.    var b3;
  21.    function GameTile008(id, dEngine, character, game, gamemc, nextLevel)
  22.    {
  23.       super(id,dEngine,character,game,gamemc,nextLevel);
  24.    }
  25.    function Update(x, y)
  26.    {
  27.       super.Update(x);
  28.       if(!this.levelComplete)
  29.       {
  30.          if(x > 2350 && y > 800)
  31.          {
  32.             _global.sounds.LoopSound("jetstream",60);
  33.          }
  34.          else
  35.          {
  36.             _global.sounds.FadeVolume("jetstream",false,false);
  37.          }
  38.          if(this.character.dmc.hitTest(this.dmc.bird1.sou) && this.dmc.bird1._visible || this.character.dmc.hitTest(this.dmc.bird2.sou) && this.dmc.bird2._visible || this.character.dmc.hitTest(this.dmc.bird3.sou) && this.dmc.bird3._visible)
  39.          {
  40.             _global.sounds.LoopSound("niao",100);
  41.          }
  42.          else
  43.          {
  44.             _global.sounds.FadeVolume("niao",false,false);
  45.          }
  46.       }
  47.       this.r1.RunHide(60,90);
  48.       this.r2.RunHide(60,90);
  49.       this.r3.RunHide(60,90);
  50.       this.r4.RunHide(60,90);
  51.       this.r5.RunHide(60,90);
  52.       this.r0.RunHide(60,90);
  53.       if(this.character.dmc.hitTest(this.dmc.sleft))
  54.       {
  55.          this.dynamicsEngine.setGravity(-3,0);
  56.       }
  57.       else
  58.       {
  59.          this.game.NormalGravity();
  60.       }
  61.    }
  62.    function Init()
  63.    {
  64.       super.Init();
  65.       var ca = this.character;
  66.       this.r0 = new org.cove.flade.surfaces.MoveRectangleTile(2035.9,833.2,200,50,this.gameMC);
  67.       this.r1 = new org.cove.flade.surfaces.MoveRectangleTile(2284.4,975.6,200,50,this.gameMC);
  68.       this.r2 = new org.cove.flade.surfaces.MoveRectangleTile(2586.9,874.1,200,100,this.gameMC);
  69.       this.r3 = new org.cove.flade.surfaces.MoveRectangleTile(2855.6,742.8,200,100,this.gameMC);
  70.       this.r4 = new org.cove.flade.surfaces.MoveRectangleTile(3213.2,603.6,200,100,this.gameMC);
  71.       this.r5 = new org.cove.flade.surfaces.MoveRectangleTile(3461.6,767.8,140,100,this.gameMC);
  72.       this.surfaces.push(this.r0);
  73.       this.surfaces.push(this.r1);
  74.       this.surfaces.push(this.r2);
  75.       this.surfaces.push(this.r3);
  76.       this.surfaces.push(this.r4);
  77.       this.surfaces.push(this.r5);
  78.       this.r1.onContact = function()
  79.       {
  80.          ca.AllowJump(true);
  81.          this.StartRunHide(true);
  82.       };
  83.       var cref = this;
  84.       this.r0.onMoveHide = function()
  85.       {
  86.          cref.dmc.cloud0.play();
  87.       };
  88.       this.r0.onMoveShow = function()
  89.       {
  90.          cref.dmc.cloud0.gotoAndStop(1);
  91.       };
  92.       this.r1.onMoveHide = function()
  93.       {
  94.          cref.dmc.cloud1.play();
  95.       };
  96.       this.r1.onMoveShow = function()
  97.       {
  98.          cref.dmc.cloud1.gotoAndStop(1);
  99.       };
  100.       this.r2.onMoveHide = function()
  101.       {
  102.          cref.dmc.cloud2.play();
  103.       };
  104.       this.r2.onMoveShow = function()
  105.       {
  106.          cref.dmc.cloud2.gotoAndStop(1);
  107.       };
  108.       this.r3.onMoveHide = function()
  109.       {
  110.          cref.dmc.cloud3.play();
  111.       };
  112.       this.r3.onMoveShow = function()
  113.       {
  114.          cref.dmc.cloud3.gotoAndStop(1);
  115.       };
  116.       this.r4.onMoveHide = function()
  117.       {
  118.          cref.dmc.cloud4.play();
  119.       };
  120.       this.r4.onMoveShow = function()
  121.       {
  122.          cref.dmc.cloud4.gotoAndStop(1);
  123.       };
  124.       this.r5.onMoveHide = function()
  125.       {
  126.          cref.dmc.cloud5.play();
  127.       };
  128.       this.r5.onMoveShow = function()
  129.       {
  130.          cref.dmc.cloud5.gotoAndStop(1);
  131.       };
  132.       this.r2.onContact = this.r3.onContact = this.r4.onContact = this.r5.onContact = this.r0.onContact = this.r1.onContact;
  133.       this.dynamicsEngine.addSurface(this.r0);
  134.       this.dynamicsEngine.addSurface(this.r1);
  135.       this.dynamicsEngine.addSurface(this.r2);
  136.       this.dynamicsEngine.addSurface(this.r3);
  137.       this.dynamicsEngine.addSurface(this.r4);
  138.       this.dynamicsEngine.addSurface(this.r5);
  139.       this.Enemy = "bird1/bird2/bird3";
  140.       this.dmc.sleft._visible = false;
  141.       var _loc4_ = new Array();
  142.       _loc4_.push(new huang.HUFO(2409.35,790.3,0,50));
  143.       _loc4_.push(new huang.HUFO(2409.35,790.3,0,50));
  144.       _loc4_.push(new huang.HUFO(2420.6,1012.9,0,50));
  145.       _loc4_.push(new huang.HUFO(2420.6,1012.9,0,50));
  146.       _loc4_.push(new huang.HUFO(2409.35,790.3,0,50));
  147.       this.b2 = new huang.HAnimation(this.dmc + ".bird1",_loc4_);
  148.       _loc4_ = new Array();
  149.       _loc4_.push(new huang.HUFO(3012,822.85,0,50));
  150.       _loc4_.push(new huang.HUFO(3012,822.85,0,50));
  151.       _loc4_.push(new huang.HUFO(3002,515.2,0,50));
  152.       _loc4_.push(new huang.HUFO(3002,515.2,0,50));
  153.       _loc4_.push(new huang.HUFO(3012,822.85,0,50));
  154.       this.b1 = new huang.HAnimation(this.dmc + ".bird2",_loc4_);
  155.       _loc4_ = new Array();
  156.       _loc4_.push(new huang.HUFO(3338.35,527.7,0,50));
  157.       _loc4_.push(new huang.HUFO(3338.35,527.7,0,50));
  158.       _loc4_.push(new huang.HUFO(3455.85,527.7,0,50));
  159.       _loc4_.push(new huang.HUFO(3455.85,527.7,0,50));
  160.       _loc4_.push(new huang.HUFO(3338.35,527.7,0,50));
  161.       this.b3 = new huang.HAnimation(this.dmc + ".bird3",_loc4_);
  162.       this.b1.vloop = this.b2.vloop = this.b3.vloop = "all";
  163.       _global.sounds.StartMusic("loop3");
  164.       this.dmc.roundedRect0._visible = this.dmc.roundedRect1._visible = this.dmc.roundedRect2._visible = false;
  165.       this.dmc.roundedRect3._visible = this.dmc.roundedRect4._visible = this.dmc.roundedRect5._visible = false;
  166.       this.dmc.roundedRect3._visible = false;
  167.    }
  168.    function Start()
  169.    {
  170.       super.Start();
  171.       this.b1.Start();
  172.       this.b2.Start();
  173.       this.b3.Start();
  174.       this.r0.SetMoveAspect(false);
  175.       this.r1.SetMoveAspect(false);
  176.       this.r2.SetMoveAspect(false);
  177.       this.r3.SetMoveAspect(false);
  178.       this.r4.SetMoveAspect(false);
  179.       this.r5.SetMoveAspect(false);
  180.    }
  181.    function Close()
  182.    {
  183.       _global.sounds.FadeVolume("jetstream",false,false);
  184.       _global.sounds.FadeVolume("niao",false,false);
  185.       super.Close();
  186.       this.b1.Close();
  187.       this.b2.Close();
  188.       this.b3.Close();
  189.    }
  190.    function LevelComplete()
  191.    {
  192.       this.levelComplete = true;
  193.       _global.sounds.FadeVolume("jetstream",false,false);
  194.       _global.sounds.FadeVolume("niao",false,false);
  195.    }
  196. }
  197.