home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Esportes / CrossingCup.swf / scripts / __Packages / game.as < prev    next >
Encoding:
Text File  |  2007-12-11  |  26.0 KB  |  878 lines

  1. class game
  2. {
  3.    var mcParent;
  4.    var playtime;
  5.    var gameon;
  6.    var def_playtime;
  7.    var world;
  8.    var iRender;
  9.    var ob;
  10.    var cornercam;
  11.    var keeper;
  12.    var kicker;
  13.    var AutoAim;
  14.    var AutoKick;
  15.    var AutoCatch;
  16.    var cornerkicker;
  17.    var mball;
  18.    var carrow;
  19.    var xrot;
  20.    var GamePhase;
  21.    var iIncomingBall;
  22.    var iCelebrate;
  23.    var cam;
  24.    var screen;
  25.    var _t;
  26.    var _fps;
  27.    static var G_START = 1;
  28.    static var G_WHISTLE = 2;
  29.    static var G_AIM = 3;
  30.    static var G_POWER = 4;
  31.    static var G_CORNERKICK = 5;
  32.    static var G_CORNERSHOOT = 6;
  33.    static var G_TRANSITION = 7;
  34.    static var G_TIMING = 8;
  35.    static var G_RECEIVING = 9;
  36.    static var G_SHOOTING = 10;
  37.    static var G_SHOOT = 11;
  38.    static var G_WINLOOSE = 12;
  39.    static var G_GAMEOVER = 13;
  40.    static var G_RESTART = 30;
  41.    static var GX_WHISTLE = 102;
  42.    static var GX_AIM = 103;
  43.    static var GX_RECEIVING = 109;
  44.    static var GX2_RECEIVING = 110;
  45.    static var GX_SHOOT = 111;
  46.    var kickerHint = false;
  47.    var keeperHint = false;
  48.    var AILevel = 0;
  49.    var purgegame = false;
  50.    function game(mc)
  51.    {
  52.       this.mcParent = mc;
  53.       this.setup3d();
  54.       this.playtime = 0;
  55.       this.gameon = true;
  56.       this.def_playtime = CSessionManager.ins().numPlayPerGame;
  57.       this.world.addEventListener(sandy.core.World3D.onRenderEVENT,this,this.renderWorld);
  58.       this.iRender = setInterval(this,"renderWorldnow",10);
  59.       EventCenter.access().addEventListener("gameevent",this);
  60.       this.kickerHint = false;
  61.       this.keeperHint = false;
  62.       var _loc2_ = new Object();
  63.       _loc2_.ob = this;
  64.       _loc2_.onKeyDown = function()
  65.       {
  66.          this.ob.cekkey();
  67.       };
  68.       Key.addListener(_loc2_);
  69.    }
  70.    function introgame(human)
  71.    {
  72.       this.gameon = true;
  73.       this.purgegame = false;
  74.       if(!this.cornercam)
  75.       {
  76.          this.switchcam();
  77.       }
  78.       this.keeper.setLevel(0);
  79.       this.kicker.setLevel(0);
  80.       this.AILevel = 0;
  81.       this.kickerHint = false;
  82.       this.keeperHint = false;
  83.       if(human)
  84.       {
  85.          this.AutoAim = false;
  86.          this.AutoKick = false;
  87.          this.AutoCatch = true;
  88.          if(CTournament.ins().tournamentPhase > 3)
  89.          {
  90.             this.keeper.setLevel(1);
  91.             this.AILevel = 1;
  92.          }
  93.          this.cornerkicker.setHuman(true);
  94.          if(CSessionManager.ins().firstTimeOffense)
  95.          {
  96.             CSessionManager.ins().firstTimeOffense = false;
  97.             _global.__DISPATCH({type:"inGameMenu",name:"showtuto"});
  98.             CSessionManager.ins().justEndTutorial = CSessionManager.ins().justEndTutorial + 1;
  99.             this.kickerHint = true;
  100.          }
  101.          else
  102.          {
  103.             _global.__DISPATCH({type:"inGameMenu",name:"hidetuto"});
  104.          }
  105.       }
  106.       else
  107.       {
  108.          this.AutoAim = true;
  109.          this.AutoKick = true;
  110.          this.AutoCatch = false;
  111.          if(CTournament.ins().tournamentPhase > 3)
  112.          {
  113.             this.kicker.setLevel(1);
  114.             this.AILevel = 1;
  115.          }
  116.          this.cornerkicker.setHuman(false);
  117.          if(CSessionManager.ins().firstTimeDefense)
  118.          {
  119.             CSessionManager.ins().firstTimeDefense = false;
  120.             _global.__DISPATCH({type:"inGameMenu",name:"showtuto"});
  121.             CSessionManager.ins().justEndTutorial = CSessionManager.ins().justEndTutorial + 1;
  122.             this.keeperHint = true;
  123.          }
  124.          else
  125.          {
  126.             _global.__DISPATCH({type:"inGameMenu",name:"hidetuto"});
  127.          }
  128.       }
  129.       this.mball.reset();
  130.       this.mball.show();
  131.       this.carrow.hide();
  132.       this.kicker.restart();
  133.       this.kicker.hide();
  134.       this.keeper.restart();
  135.       this.keeper.hide();
  136.       this.cornerkicker.restart();
  137.       this.cornerkicker.show();
  138.    }
  139.    function initgame()
  140.    {
  141.       this.pumpgame(game.G_START);
  142.    }
  143.    function startgame()
  144.    {
  145.       this.xrot = 0;
  146.       this.pumpgame(game.GX_WHISTLE);
  147.    }
  148.    function endgame()
  149.    {
  150.       this.gameon = false;
  151.       SoundManager.ins().fadeAmbience(false);
  152.       this.GamePhase = -1;
  153.    }
  154.    function gameevent(event)
  155.    {
  156.       if(this.purgegame)
  157.       {
  158.          return undefined;
  159.       }
  160.       switch(event.param)
  161.       {
  162.          case "cheat":
  163.             var _loc3_ = CTournament.ins().currentMatch;
  164.             if(CTeamManager.ins().currentTeam == _loc3_.team1)
  165.             {
  166.                if(event.win)
  167.                {
  168.                   _loc3_.addScorea(1,0);
  169.                }
  170.                else
  171.                {
  172.                   _loc3_.addScorea(0,1);
  173.                }
  174.             }
  175.             else if(event.win)
  176.             {
  177.                _loc3_.addScorea(0,1);
  178.             }
  179.             else
  180.             {
  181.                _loc3_.addScorea(1,0);
  182.             }
  183.             _loc3_.round = 2;
  184.             _loc3_.totalkick1 = 0;
  185.             _loc3_.totalkick2 = 0;
  186.             this.playtime = this.def_playtime * 2;
  187.             this.pumpgame(game.G_RESTART);
  188.             break;
  189.          case "dialogendgame":
  190.             this.KillTheGame();
  191.             _global.__DISPATCH({type:"inGameMenu",name:"stopdialog"});
  192.             break;
  193.          case "dialognoendgame":
  194.             _global.__DISPATCH({type:"inGameMenu",name:"stopdialog"});
  195.             break;
  196.          case "skiptutorial":
  197.             CSessionManager.ins().firstTimeOffense = false;
  198.             CSessionManager.ins().firstTimeDefense = false;
  199.             CSessionManager.ins().justEndTutorial = 0;
  200.             this.kickerHint = false;
  201.             this.keeperHint = false;
  202.             _global.__DISPATCH({type:"inGameMenu",name:"hidetuto"});
  203.             _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  204.             this.pumpgame(game.G_WHISTLE);
  205.             break;
  206.          case "playtutorial":
  207.             this.pumpgame(game.G_WHISTLE);
  208.             break;
  209.          case "startgamealready":
  210.             if(this.AutoAim)
  211.             {
  212.                event.obyek.indicator._visible = true;
  213.             }
  214.             else
  215.             {
  216.                event.obyek.indicator._visible = false;
  217.             }
  218.             this.startgame();
  219.             break;
  220.          case "playambience":
  221.             break;
  222.          case "cornerkick":
  223.             this.pumpgame(game.G_CORNERSHOOT);
  224.             break;
  225.          case "transition":
  226.             this.pumpgame(game.G_TRANSITION);
  227.             break;
  228.          case "finishtransition":
  229.             this.pumpgame(game.G_TIMING);
  230.             break;
  231.          case "shooting":
  232.             this.pumpgame(game.G_SHOOTING);
  233.             break;
  234.          case "shoot":
  235.             this.pumpgame(game.GX_SHOOT);
  236.             break;
  237.          case "headingcontact":
  238.             var _loc5_ = this.kicker.getPosition();
  239.             var _loc4_ = this.mball.getPosition();
  240.             var _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  241.             var _loc8_ = Math.abs(_loc5_.y + _loc4_.y + 2.5);
  242.             var _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  243.             if(_loc9_ < 2 && _loc8_ < 0.8 && _loc7_ < 0.5)
  244.             {
  245.                this.kicker.makeshoot();
  246.             }
  247.             break;
  248.          case "volleycontact":
  249.             _loc5_ = this.kicker.getPosition();
  250.             _loc4_ = this.mball.getPosition();
  251.             _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  252.             _loc8_ = Math.abs(_loc5_.y - _loc4_.y);
  253.             _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  254.             if(_loc9_ < 1.5 && _loc8_ < 1.5 && _loc7_ < 1)
  255.             {
  256.                this.kicker.makeshoot();
  257.             }
  258.             break;
  259.          case "backflipcontact":
  260.             _loc5_ = this.kicker.getPosition();
  261.             _loc4_ = this.mball.getPosition();
  262.             _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  263.             _loc8_ = Math.abs(_loc5_.y + _loc4_.y + 2);
  264.             _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  265.             if(_loc9_ < 2 && _loc8_ < 1 && _loc7_ < 1.1)
  266.             {
  267.                this.kicker.makeshoot();
  268.             }
  269.             break;
  270.          case "divecontact":
  271.             _loc5_ = this.kicker.getPosition();
  272.             _loc4_ = this.mball.getPosition();
  273.             _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  274.             _loc8_ = Math.abs(_loc5_.y + _loc4_.y);
  275.             _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  276.             if(_loc9_ < 5 && _loc8_ < 1.5 && _loc7_ < 1)
  277.             {
  278.                this.kicker.makeshoot();
  279.             }
  280.             break;
  281.          case "chestvolleycontact":
  282.             _loc5_ = this.kicker.getPosition();
  283.             _loc4_ = this.mball.getPosition();
  284.             _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  285.             _loc8_ = Math.abs(_loc5_.y + _loc4_.y + 0.5);
  286.             _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  287.             if(_loc9_ < 1 && _loc8_ < 2 && _loc7_ < 1.2)
  288.             {
  289.                this.mball.haltedit();
  290.                SoundManager.ins().playKick();
  291.             }
  292.             break;
  293.          case "chestvolleykick":
  294.             if(this.mball.halted)
  295.             {
  296.                this.kicker.makeshoot();
  297.             }
  298.             break;
  299.          case "heading":
  300.          case "volley":
  301.          case "dive":
  302.          case "backflip":
  303.          case "chestvolley":
  304.             this.kicker.toidle();
  305.             break;
  306.          case "ballout":
  307.             if(this.GamePhase != game.G_WINLOOSE)
  308.             {
  309.                this.keeper.win();
  310.                this.kicker.loose();
  311.                this.pumpgame(game.G_WINLOOSE);
  312.             }
  313.             break;
  314.          case "goal":
  315.             this.keeper.loose();
  316.             this.kicker.win();
  317.             SoundManager.ins().playVictory();
  318.             if(!this.kickerHint && !this.keeperHint)
  319.             {
  320.                CTournament.ins().currentMatch.addScore();
  321.                _global.__DISPATCH({type:"changeScore"});
  322.             }
  323.             this.pumpgame(game.G_WINLOOSE);
  324.             break;
  325.          case "loose":
  326.             this.keeper.win();
  327.             this.kicker.loose();
  328.             this.pumpgame(game.G_WINLOOSE);
  329.             break;
  330.          case "enteringhurdle":
  331.             if(!this.keeper.cekGoal(this.mball))
  332.             {
  333.                this.mball.deflect();
  334.                this.mball.ingoalsequence = 5;
  335.                this.kicker.loose();
  336.                this.pumpgame(game.G_WINLOOSE);
  337.             }
  338.             else
  339.             {
  340.                SoundManager.ins().playGoal();
  341.                _global.__DISPATCH({type:"gameevent",param:"goal"});
  342.                this.mball.ingoalsequence = 4;
  343.             }
  344.       }
  345.    }
  346.    function setIncomingBallTimer()
  347.    {
  348.       var _loc2_ = 0;
  349.       this.AILevel != 0 ? (_loc2_ = 1700) : (_loc2_ = 2200);
  350.       if(this.kickerHint)
  351.       {
  352.          _loc2_ += 2500;
  353.       }
  354.       this.iIncomingBall = setInterval(this,"IncomingBall",_loc2_);
  355.    }
  356.    function IncomingBall()
  357.    {
  358.       clearInterval(this.iIncomingBall);
  359.       if(!this.kickerHint && !this.keeperHint)
  360.       {
  361.          this.pumpgame(game.G_RECEIVING);
  362.       }
  363.    }
  364.    function endwhistle()
  365.    {
  366.       this.pumpgame(game.GX_AIM);
  367.    }
  368.    function pumpgame(phase)
  369.    {
  370.       if(phase == undefined)
  371.       {
  372.          this.GamePhase = this.GamePhase + 1;
  373.          phase = this.GamePhase;
  374.       }
  375.       else
  376.       {
  377.          this.GamePhase = phase;
  378.       }
  379.       switch(phase)
  380.       {
  381.          case game.G_START:
  382.             this.playtime = 0;
  383.             break;
  384.          case game.GX_WHISTLE:
  385.             if(CSessionManager.ins().firstTimer)
  386.             {
  387.                _global.__DISPATCH({type:"inGameHelp",param:"firsttimer"});
  388.                CSessionManager.ins().firstTimer = false;
  389.                return undefined;
  390.             }
  391.             if(CSessionManager.ins().justEndTutorial == 3)
  392.             {
  393.                _global.__DISPATCH({type:"inGameHelp",param:"endtutorial"});
  394.                _global.__DISPATCH({type:"inGameMenu",name:"hidetuto"});
  395.                return undefined;
  396.             }
  397.             if(CSessionManager.ins().justEndTutorial == 2)
  398.             {
  399.                CSessionManager.ins().justEndTutorial = CSessionManager.ins().justEndTutorial + 1;
  400.             }
  401.             this.pumpgame(game.G_WHISTLE);
  402.             break;
  403.          case game.G_WHISTLE:
  404.             if(this.kickerHint)
  405.             {
  406.                _global.__DISPATCH({type:"inGameHelp",param:"aiming"});
  407.             }
  408.             if(this.keeperHint)
  409.             {
  410.                _global.__DISPATCH({type:"inGameHelp",param:"keeperwait"});
  411.             }
  412.             SoundManager.ins().playWhistle();
  413.             EventCenter.access().addEventListener("endwhistle",this);
  414.             if(!this.AutoKick)
  415.             {
  416.                this.carrow.show();
  417.                this.mball.hide();
  418.             }
  419.             else
  420.             {
  421.                this.mball.show();
  422.                this.carrow.hide();
  423.             }
  424.             this.cornerkicker.show();
  425.             break;
  426.          case game.GX_AIM:
  427.             if(!this.kickerHint && !this.keeperHint && CSessionManager.ins().justEndTutorial != 3)
  428.             {
  429.                this.pumpgame(game.G_AIM);
  430.             }
  431.             break;
  432.          case game.G_POWER:
  433.             if(this.kickerHint)
  434.             {
  435.                _global.__DISPATCH({type:"inGameHelp",param:"power"});
  436.             }
  437.             this.carrow.powering();
  438.             break;
  439.          case game.G_CORNERKICK:
  440.             this.carrow.unpowering();
  441.             this.mball.show();
  442.             this.carrow.hide();
  443.             this.cornerkicker.setHuman(false);
  444.             this.cornerkicker.kick();
  445.             break;
  446.          case game.G_CORNERSHOOT:
  447.             if(this.kickerHint)
  448.             {
  449.                _global.__DISPATCH({type:"inGameHelp",param:"cross"});
  450.             }
  451.             SoundManager.ins().playKick();
  452.             this.mball.shoot(this.carrow.power,this.carrow.rx,this.carrow.ry);
  453.             break;
  454.          case game.G_TRANSITION:
  455.             this.mball.hide();
  456.             this.mcParent._parent.latar.gotoAndPlay(2);
  457.             this.mcParent._parent.indicator._visible = false;
  458.             this.mcParent._visible = false;
  459.             this.switchcam();
  460.             if(this.AutoKick)
  461.             {
  462.                this.kicker.startrun();
  463.             }
  464.             break;
  465.          case game.G_TIMING:
  466.             if(this.kickerHint)
  467.             {
  468.                _global.__DISPATCH({type:"inGameHelp",param:"moving"});
  469.                this.pumpgame(game.GX_RECEIVING);
  470.             }
  471.             if(this.keeperHint)
  472.             {
  473.                _global.__DISPATCH({type:"inGameHelp",param:"keepermove"});
  474.             }
  475.             if(!this.kickerHint && !this.keeperHint)
  476.             {
  477.                this.setIncomingBallTimer();
  478.             }
  479.             this.mcParent._visible = true;
  480.             this.kicker.show();
  481.             this.keeper.show();
  482.             if(this.AutoKick)
  483.             {
  484.                this.kicker.action();
  485.                this.kicker.setHuman(false);
  486.                this.keeper.setHuman(true);
  487.             }
  488.             else
  489.             {
  490.                this.kicker.setHuman(true);
  491.                this.keeper.setHuman(false);
  492.             }
  493.             break;
  494.          case game.GX_RECEIVING:
  495.             break;
  496.          case game.GX2_RECEIVING:
  497.             this.mball.show();
  498.             break;
  499.          case game.G_RECEIVING:
  500.             if(this.kickerHint)
  501.             {
  502.                this.setIncomingBallTimer();
  503.             }
  504.             this.mball.show();
  505.             if(this.AutoKick)
  506.             {
  507.                this.mball.startTrajectoryCounter(3);
  508.             }
  509.             break;
  510.          case game.G_SHOOTING:
  511.             this.mball.ingoalsequence = 1;
  512.             break;
  513.          case game.GX_SHOOT:
  514.             if(this.keeperHint)
  515.             {
  516.                _global.__DISPATCH({type:"inGameHelp",param:"keepercatch"});
  517.             }
  518.             else
  519.             {
  520.                this.pumpgame(game.G_SHOOT);
  521.             }
  522.             break;
  523.          case game.G_SHOOT:
  524.             SoundManager.ins().playKick();
  525.             this.kicker.setHuman(false);
  526.             if(this.AutoCatch)
  527.             {
  528.                this.keeper.catchball(this.mball);
  529.                this.keeper.startcatch();
  530.             }
  531.             break;
  532.          case game.G_WINLOOSE:
  533.             this.iCelebrate = setInterval(this,"endCelebrate",3000);
  534.             break;
  535.          case game.G_RESTART:
  536.             if(SoundManager.ins().goalplayed)
  537.             {
  538.                SoundManager.ins().fadeGoal(false);
  539.             }
  540.             this.mball.reset();
  541.             this.cornerkicker.hide();
  542.             this.kicker.setHuman(false);
  543.             this.kicker.hide();
  544.             this.keeper.setHuman(false);
  545.             this.keeper.hide();
  546.             this.mball.hide();
  547.             this.carrow.hide();
  548.             this.mcParent._parent.latar.gotoAndStop(1);
  549.             if(!this.cornercam)
  550.             {
  551.                this.switchcam();
  552.             }
  553.             if(!this.keeperHint && !this.kickerHint)
  554.             {
  555.                this.playtime = this.playtime + 1;
  556.                _global.__DISPATCH({type:"updateBallCounter"});
  557.             }
  558.             var _loc5_ = this.keeperHint;
  559.             this.keeperHint = false;
  560.             var _loc4_ = this.kickerHint;
  561.             this.kickerHint = false;
  562.             _global.__DISPATCH({type:"endGame",h1:_loc5_,h2:_loc4_});
  563.             this.GamePhase = game.G_GAMEOVER;
  564.       }
  565.    }
  566.    function playtimeover()
  567.    {
  568.       if(this.playtime >= this.def_playtime * 2)
  569.       {
  570.          return true;
  571.       }
  572.       return false;
  573.    }
  574.    function endCelebrate()
  575.    {
  576.       clearInterval(this.iCelebrate);
  577.       this.pumpgame(game.G_RESTART);
  578.    }
  579.    function renderWorld()
  580.    {
  581.       if(this.GamePhase == game.G_CORNERSHOOT)
  582.       {
  583.          this.mball.render();
  584.          return undefined;
  585.       }
  586.       if(this.GamePhase == game.G_RECEIVING)
  587.       {
  588.          this.mball.render();
  589.          return undefined;
  590.       }
  591.       if(this.GamePhase == game.G_SHOOTING)
  592.       {
  593.          this.mball.render();
  594.          return undefined;
  595.       }
  596.       if(this.GamePhase == game.G_SHOOT)
  597.       {
  598.          this.mball.render();
  599.          return undefined;
  600.       }
  601.       if(this.GamePhase == game.G_WINLOOSE)
  602.       {
  603.          this.mball.render();
  604.          return undefined;
  605.       }
  606.    }
  607.    function renderWorldnow()
  608.    {
  609.       if(!this.gameon)
  610.       {
  611.          return undefined;
  612.       }
  613.       if(this.GamePhase == game.G_AIM)
  614.       {
  615.          if(this.AutoAim)
  616.          {
  617.             if(!this.kickerHint && !this.keeperHint)
  618.             {
  619.                this.carrow.autoAim(false);
  620.             }
  621.             else
  622.             {
  623.                this.carrow.autoAim(true);
  624.             }
  625.             this.pumpgame(game.G_CORNERKICK);
  626.          }
  627.          if(Key.isDown(38))
  628.          {
  629.             this.carrow.up();
  630.          }
  631.          if(Key.isDown(40))
  632.          {
  633.             this.carrow.down();
  634.          }
  635.          if(Key.isDown(37))
  636.          {
  637.             this.carrow.left();
  638.          }
  639.          if(Key.isDown(39))
  640.          {
  641.             this.carrow.right();
  642.          }
  643.          return undefined;
  644.       }
  645.       if(this.GamePhase == game.G_TIMING)
  646.       {
  647.          if(this.AutoKick)
  648.          {
  649.             this.kicker.cekrun();
  650.          }
  651.          else
  652.          {
  653.             this.kicker.cekinput();
  654.          }
  655.          if(!this.AutoCatch)
  656.          {
  657.             this.keeper.cekinputA(this.mball);
  658.          }
  659.          return undefined;
  660.       }
  661.       if(this.GamePhase == game.GX2_RECEIVING)
  662.       {
  663.          this.kicker.cekinput(false);
  664.          return undefined;
  665.       }
  666.       if(this.GamePhase == game.G_RECEIVING)
  667.       {
  668.          if(this.AutoKick)
  669.          {
  670.             this.kicker.cekrun();
  671.          }
  672.          else
  673.          {
  674.             this.kicker.cekinput();
  675.          }
  676.          if(!this.AutoCatch)
  677.          {
  678.             this.keeper.cekinputA(this.mball);
  679.          }
  680.          return undefined;
  681.       }
  682.       if(this.GamePhase == game.G_SHOOTING)
  683.       {
  684.          if(!this.AutoCatch)
  685.          {
  686.             this.keeper.cekinputA(this.mball);
  687.          }
  688.          return undefined;
  689.       }
  690.       if(this.GamePhase == game.GX_SHOOT)
  691.       {
  692.          return undefined;
  693.       }
  694.       if(this.GamePhase == game.G_SHOOT)
  695.       {
  696.          if(!this.AutoCatch)
  697.          {
  698.             this.keeper.cekinputA(this.mball);
  699.          }
  700.          this.mball.cekinggoal();
  701.          return undefined;
  702.       }
  703.       if(this.GamePhase == game.G_WINLOOSE)
  704.       {
  705.          this.mball.cekinggoal();
  706.          return undefined;
  707.       }
  708.    }
  709.    function cekkey()
  710.    {
  711.       var _loc3_ = Key.getCode();
  712.       if(this.kickerHint)
  713.       {
  714.          if(Key.isDown(37) || Key.isDown(39) || Key.isDown(38) || Key.isDown(40))
  715.          {
  716.             if(this.GamePhase == game.GX_AIM)
  717.             {
  718.                this.pumpgame(game.G_AIM);
  719.                _global.__DISPATCH({type:"inGameHelp",param:"doneaiming"});
  720.                return undefined;
  721.             }
  722.          }
  723.          if(_loc3_ == 192 || _loc3_ == 13)
  724.          {
  725.             if(this.GamePhase == game.GX_RECEIVING)
  726.             {
  727.                this.pumpgame(game.GX2_RECEIVING);
  728.                _global.__DISPATCH({type:"inGameHelp",param:"moving2"});
  729.                return undefined;
  730.             }
  731.             if(this.GamePhase == game.GX2_RECEIVING)
  732.             {
  733.                this.pumpgame(game.G_RECEIVING);
  734.                _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  735.                return undefined;
  736.             }
  737.             return undefined;
  738.          }
  739.       }
  740.       if(this.keeperHint)
  741.       {
  742.          if(_loc3_ == 192 || _loc3_ == 13)
  743.          {
  744.             if(this.GamePhase == game.G_TIMING)
  745.             {
  746.                this.pumpgame(game.G_RECEIVING);
  747.                _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  748.                return undefined;
  749.             }
  750.             if(this.GamePhase == game.GX_SHOOT)
  751.             {
  752.                this.pumpgame(game.G_SHOOT);
  753.                _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  754.                return undefined;
  755.             }
  756.             if(this.GamePhase == game.GX_AIM)
  757.             {
  758.                this.pumpgame(game.G_AIM);
  759.                _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  760.                return undefined;
  761.             }
  762.          }
  763.       }
  764.       if(Key.isDown(32))
  765.       {
  766.          switch(this.GamePhase)
  767.          {
  768.             case game.G_AIM:
  769.                this.pumpgame(game.G_POWER);
  770.                break;
  771.             case game.G_POWER:
  772.                this.pumpgame(game.G_CORNERKICK);
  773.                break;
  774.             case game.G_SHOOTING:
  775.             case game.G_SHOOT:
  776.                if(!this.AutoCatch)
  777.                {
  778.                   this.keeper.spacehit(this.mball);
  779.                   break;
  780.                }
  781.          }
  782.       }
  783.       if(_loc3_ == 192 || _loc3_ == 13)
  784.       {
  785.          if(this.GamePhase == game.GX_WHISTLE)
  786.          {
  787.             this.pumpgame(game.G_WHISTLE);
  788.             _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  789.             CSessionManager.ins().justEndTutorial = 0;
  790.             return undefined;
  791.          }
  792.       }
  793.    }
  794.    function switchcam()
  795.    {
  796.       if(this.cornercam)
  797.       {
  798.          this.cam.setPosition(28.339,4.808,0);
  799.          this.cam.rotateX(2);
  800.          this.cam.rotateY(90);
  801.       }
  802.       else
  803.       {
  804.          this.cam.setPosition(50,5.5,-51);
  805.          this.cam.rotateY(-90);
  806.          this.cam.rotateX(-2);
  807.       }
  808.       this.cornercam = !this.cornercam;
  809.    }
  810.    function setup3d()
  811.    {
  812.       this.world = sandy.core.World3D.getInstance();
  813.       this.screen = new sandy.view.ClipScreen(this.mcParent.createEmptyMovieClip("screen",1),640,400);
  814.       this.cam = new sandy.view.Camera3D(620,this.screen);
  815.       this.cam.setPosition(50,5.5,-51);
  816.       this.cam.rotateX(-10);
  817.       this.cornercam = true;
  818.       this.world.addCamera(this.cam);
  819.       var _loc2_ = new sandy.core.group.Group();
  820.       this.world.setRootGroup(_loc2_);
  821.       this.mball = new CBall(_loc2_,this.mcParent);
  822.       this.carrow = new CArrow(_loc2_,this.mcParent);
  823.       this.cornerkicker = new CCornerKicker(_loc2_,this.mcParent);
  824.       this.keeper = new CKeeper(_loc2_,this.mcParent);
  825.       this.kicker = new CKicker(_loc2_,this.mcParent,this.mball);
  826.       this.world.render();
  827.    }
  828.    function createField(bg, x, y, z)
  829.    {
  830.       var _loc4_ = new sandy.primitive.Plane3D(90,120,5,"tri");
  831.       var _loc6_ = new sandy.skin.MixedSkin(65280,80,0,100,1);
  832.       _loc4_.setSkin(_loc6_);
  833.       var _loc1_ = new sandy.core.group.TransformGroup();
  834.       var _loc2_ = new sandy.core.group.TransformGroup();
  835.       var _loc5_ = new sandy.core.transform.Transform3D();
  836.       var _loc3_ = new sandy.core.transform.Transform3D();
  837.       _loc5_.rot(0,0,0);
  838.       _loc3_.translate(x,y,z);
  839.       _loc1_.setTransform(_loc5_);
  840.       _loc2_.setTransform(_loc3_);
  841.       _loc1_.addChild(_loc4_);
  842.       _loc2_.addChild(_loc1_);
  843.       bg.addChild(_loc2_);
  844.    }
  845.    function setupfps()
  846.    {
  847.       this.mcParent.createTextField("fps",10000,0,200,50,20);
  848.       this.mcParent.fps.size = 14;
  849.       this.mcParent.fps.color = 16777215;
  850.       this._t = getTimer();
  851.       this._fps = 0;
  852.    }
  853.    function KillTheGame()
  854.    {
  855.       _global.__DISPATCH({type:"inGameHelp",param:"stopdialog"});
  856.       CSessionManager.ins().firstTimeOffense = false;
  857.       CSessionManager.ins().firstTimeDefense = false;
  858.       this.kickerHint = false;
  859.       this.keeperHint = false;
  860.       var _loc3_ = CTournament.ins().currentMatch;
  861.       if(CTeamManager.ins().currentTeam == _loc3_.team1)
  862.       {
  863.          _loc3_.addScorea(1,0);
  864.       }
  865.       else
  866.       {
  867.          _loc3_.addScorea(0,1);
  868.       }
  869.       _loc3_.round = 2;
  870.       _loc3_.totalkick1 = 0;
  871.       _loc3_.totalkick2 = 0;
  872.       this.playtime = this.def_playtime * 2;
  873.       CTournament.ins().endTournament();
  874.       this.pumpgame(game.G_RESTART);
  875.       this.purgegame = true;
  876.    }
  877. }
  878.