home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / gladiator_castle_war.swf / scripts / frame_7 / DoAction.as
Encoding:
Text File  |  2007-03-15  |  27.4 KB  |  848 lines

  1. function degToRad(deg)
  2. {
  3.    return deg * 3.141592653589793 / 180;
  4. }
  5. function radToDeg(rad)
  6. {
  7.    return rad * 180 / 3.141592653589793;
  8. }
  9. function rotate(obj, deg)
  10. {
  11.    rad = degToRad(deg);
  12.    cos = Math.cos(rad);
  13.    sin = Math.sin(rad) * aspect;
  14.    matrix = new flash.geom.Matrix(cos * obj._xscale / 100,sin,0,obj._yscale / 100,obj._x,obj._y);
  15.    obj.transform.matrix = matrix;
  16. }
  17. function easeTo(pos, trg, amnt)
  18. {
  19.    return (trg + pos * (amnt - 1)) / amnt;
  20. }
  21. function closeGame()
  22. {
  23.    Key.removeListener(charListener);
  24. }
  25. function moveChar(charMC)
  26. {
  27.    charMC.xspeed *= 0.6;
  28.    charMC.yspeed *= 0.6;
  29.    charMC.x += charMC.xspeed;
  30.    charMC.y += charMC.yspeed;
  31.    if(charMC.x < (- mapwide) / 2)
  32.    {
  33.       charMC.x = (- mapwide) / 2;
  34.    }
  35.    if(charMC.x > mapwide / 2)
  36.    {
  37.       charMC.x = mapwide / 2;
  38.    }
  39.    if(charMC.y < (- maphigh) / 2)
  40.    {
  41.       if(charMC.y < -440)
  42.       {
  43.          charMC.y += 20;
  44.          if(charMC.x > 80)
  45.          {
  46.             charMC.x = 80;
  47.          }
  48.          if(charMC.x < -80)
  49.          {
  50.             charMC.x = -80;
  51.          }
  52.       }
  53.       else
  54.       {
  55.          charMC.y = (- maphigh) / 2;
  56.       }
  57.       walkin = true;
  58.    }
  59.    if(charMC.y > maphigh / 2)
  60.    {
  61.       charMC.y -= 20;
  62.       walkin = true;
  63.    }
  64. }
  65. function attachWallPanel(x, y, rot, type)
  66. {
  67.    d = game.getNextHighestDepth();
  68.    panel = game.attachMovie(type,"wallpanel" + itemRoller++,d);
  69.    wallpanels.push(panel);
  70.    panel.x = x;
  71.    panel.y = y;
  72.    panel.z = 0;
  73.    panel.rot = rot;
  74.    panel.hardcodeDepth = hardcodeDepth;
  75.    return panel;
  76. }
  77. function attachTopPanel(x, y, rot, hardcodeDepth)
  78. {
  79.    d = hardcodeDepth === undefined ? game.getNextHighestDepth() : hardcodeDepth + 100000;
  80.    panelHolder = game.createEmptyMovieClip("topTileHolder" + itemRoller++,d);
  81.    panel = panelHolder.attachMovie("blockTopTile","panel",1);
  82.    panelHolder._yscale = 100 * aspect;
  83.    toppanels.push(panel);
  84.    panel.x = x;
  85.    panel.y = y;
  86.    panelHolder.y = y - 200;
  87.    panelHolder.z = wallHeight;
  88.    panelHolder.hardcodeDepth = hardcodeDepth;
  89.    panel.rot = rot;
  90.    return panelHolder;
  91. }
  92. function addCharacter(name, x, y, jumpPower, walkSpeed, att, def, team, charnum, boss)
  93. {
  94.    s = game.attachMovie(name,"char" + itemRoller++,game.getNextHighestDepth());
  95.    s.points = startPoints;
  96.    s.charnum = charnum;
  97.    s.x = x;
  98.    s.y = y;
  99.    s.z = 0;
  100.    s.att = att;
  101.    s.def = def;
  102.    s.team = team;
  103.    s.boss = boss;
  104.    s.jumpPower = jumpPower;
  105.    s.walkSpeed = walkSpeed;
  106.    s.xspeed = 0;
  107.    s.yspeed = 0;
  108.    s.zspeed = 0;
  109.    s.health = 100;
  110.    s.shadow = game.attachMovie("shadow","shadow" + itemRoller++,game.getNextHighestDepth());
  111.    s.shadow._yscale = 100 * aspect;
  112.    activeChars.push(s);
  113.    return s;
  114. }
  115. function sortDepths(ar)
  116. {
  117.    newar = [];
  118.    for(a in ar)
  119.    {
  120.       obj = ar[a];
  121.       newar.push({obj:obj,y:obj.y});
  122.    }
  123.    newar.sortOn("y",Array.NUMERIC);
  124.    a = 0;
  125.    while(a < newar.length)
  126.    {
  127.       v = newar.shift();
  128.       newar.push(v.obj);
  129.       a++;
  130.    }
  131.    return newar;
  132. }
  133. changeBGMusic("battlemusic");
  134. var so = SharedObject.getLocal("unlockable");
  135. if(!battlesound)
  136. {
  137.    battlesound = new Sound();
  138. }
  139. battlesound.setVolume(curvol);
  140. stop();
  141. aspect = 0.5;
  142. test_aspect._y = 50;
  143. test_aspect.onPress = function()
  144. {
  145.    this.active = true;
  146. };
  147. test_aspect.onRelease = test_aspect.onReleaseOutside = function()
  148. {
  149.    this.active = false;
  150. };
  151. test_aspect.onEnterFrame = function()
  152. {
  153.    if(this.active)
  154.    {
  155.       this._y = _root._ymouse;
  156.       depthaspect = this._y;
  157.    }
  158. };
  159. depthaspect = 200;
  160. arenaRotation = 0;
  161. wallHeight = 80;
  162. groundHolder = game.createEmptyMovieClip("groundholder",-1000000);
  163. ground = groundHolder.attachMovie("groundtile","ground",-1000);
  164. groundHolder._yscale = 100 * aspect;
  165. activeChars = [];
  166. wallpanels = [];
  167. toppanels = [];
  168. itemRoller = 0;
  169. mapwide = 800;
  170. maphigh = 800;
  171. pts1 = pts2 = pts3 = pts4 = pts5 = pts6 = startPoints;
  172. playerStats = {agi:40,def:0,att:0};
  173. itms = new Array();
  174. itms.push(possibleWeapons[playerActiveWeapon]);
  175. itms.push(possibleShields[playerActiveShield]);
  176. itms.push(possibleHelmets[playerActiveHelmet]);
  177. itms.push(possibleArmours[playerActiveArmour]);
  178. itms.push(possibleArms[playerActiveArms]);
  179. itms.push(possibleBoots[playerActiveBoots]);
  180. for(i in itms)
  181. {
  182.    item = itms[i];
  183.    if(item.attr.agi !== undefined)
  184.    {
  185.       playerStats.agi += item.attr.agi;
  186.    }
  187.    if(item.attr.att !== undefined)
  188.    {
  189.       playerStats.att += item.attr.att;
  190.    }
  191.    if(item.attr.def !== undefined)
  192.    {
  193.       playerStats.def += item.attr.def;
  194.    }
  195. }
  196. if(so.data.doubledamage)
  197. {
  198.    playerStats.att *= 2;
  199. }
  200. playerCharacter = addCharacter("dwarf",0,1000,playerStats.agi,playerStats.agi / 4,playerStats.att,playerStats.def,1,1);
  201. addCharacter("dwarf",0,900,40,10,0,0,1,2);
  202. pts3mc._visible = pts4mc._visible = pts5mc._visible = pts6mc._visible = false;
  203. _root.pts3_txt = _root.pts4_txt = _root.pts5_txt = _root.pts6_txt = "";
  204. for(e in battleEnemies)
  205. {
  206.    en = battleEnemies[e];
  207.    n = 3 + Number(e);
  208.    _root["pts" + n + "mc"]._visible = true;
  209.    _root["pts" + n + "_txt"] = en.mc;
  210.    addCharacter(en.mc,0,-800,en.jump,en.walk,en.att,en.def,2,n,en.boss);
  211. }
  212. l = attachWallPanel(100,100,270,"wallpanel");
  213. r = attachWallPanel(300,100,270,"wallpanel");
  214. f = attachWallPanel(300,300,0,"wallpanel");
  215. t = attachTopPanel(100,300,0);
  216. boxFront = [l,r,f,t];
  217. l = attachWallPanel(-300,-300,270,"wallpanel");
  218. r = attachWallPanel(-100,-300,270,"wallpanel");
  219. f = attachWallPanel(-100,-100,0,"wallpanel");
  220. t = attachTopPanel(-300,-100,0);
  221. boxRear = [l,r,f,t];
  222. backWall = attachWallPanel(400,-400,0,"backWall");
  223. wallObjects = new Array();
  224. wallObjects.push(new flash.geom.Rectangle(100,100,200,200));
  225. wallObjects.push(new flash.geom.Rectangle(-300,-300,200,200));
  226. var charListener = new Object();
  227. charListener.char = char;
  228. charListener.onKeyUp = function()
  229. {
  230.    if(Key.getCode() == 37)
  231.    {
  232.       lastLeftUp = getTimer();
  233.    }
  234.    if(Key.getCode() == 39)
  235.    {
  236.       lastRightUp = getTimer();
  237.    }
  238. };
  239. charListener.onKeyDown = function()
  240. {
  241.    if(Key.getCode() == 37)
  242.    {
  243.       if(getTimer() - lastLeftUp < 100)
  244.       {
  245.          if(!playerCharacter.waitForAnimation)
  246.          {
  247.             playerCharacter.gotoAndPlay("dash");
  248.          }
  249.       }
  250.    }
  251.    if(Key.getCode() == 39)
  252.    {
  253.       if(getTimer() - lastRightUp < 100)
  254.       {
  255.          if(!playerCharacter.waitForAnimation)
  256.          {
  257.             playerCharacter.gotoAndPlay("dash");
  258.          }
  259.       }
  260.    }
  261.    if(Key.getCode() == 88)
  262.    {
  263.       if(!playerCharacter.waitForAnimation)
  264.       {
  265.          if(playerCharacter.airborne)
  266.          {
  267.             playerCharacter.gotoAndPlay("airattack");
  268.          }
  269.          else
  270.          {
  271.             switch(possibleWeapons[playerActiveWeapon].type)
  272.             {
  273.                case "sword":
  274.                   playerCharacter.gotoAndPlay("attack1");
  275.                   break;
  276.                case "spear":
  277.                   playerCharacter.gotoAndPlay("attackspear");
  278.                   break;
  279.                case "axe":
  280.                   playerCharacter.gotoAndPlay("attackaxe");
  281.             }
  282.          }
  283.          playerCharacter.comboLvl = 1;
  284.       }
  285.       else
  286.       {
  287.          playerCharacter.comboLvl = playerCharacter.comboLvl + 1;
  288.          if(playerCharacter.currentAction == "dash")
  289.          {
  290.          }
  291.       }
  292.    }
  293.    if(Key.getCode() == 90)
  294.    {
  295.       if(!playerCharacter.airborne and !playerCharacter.waitForAnimation)
  296.       {
  297.          playerCharacter.zspeed += playerCharacter.jumpPower;
  298.          playerCharacter.airborne = true;
  299.       }
  300.    }
  301.    if(Key.getCode() == 67)
  302.    {
  303.       if(!playerCharacter.airborne and !playerCharacter.waitForAnimation)
  304.       {
  305.          playerCharacter.gotoAndPlay("block");
  306.       }
  307.    }
  308. };
  309. Key.addListener(charListener);
  310. game.onEnterFrame = function()
  311. {
  312.    if(playerCharacter)
  313.    {
  314.       arenaRotation = (- playerCharacter.x) / 15;
  315.    }
  316.    r = degToRad(arenaRotation);
  317.    c = Math.cos(r);
  318.    s = Math.sin(r);
  319.    ground._rotation = arenaRotation;
  320.    for(ch in activeChars)
  321.    {
  322.       char = activeChars[ch];
  323.       spd = 18;
  324.       if(!char.waitForAnimation)
  325.       {
  326.          oldpos = {x:char.x,y:char.y};
  327.          if(char == playerCharacter)
  328.          {
  329.             walkin = false;
  330.             if(Key.isDown(38))
  331.             {
  332.                char.yspeed -= char.walkSpeed;
  333.                walkin = true;
  334.             }
  335.             else if(Key.isDown(40))
  336.             {
  337.                char.yspeed += char.walkSpeed;
  338.                walkin = true;
  339.             }
  340.             if(Key.isDown(37))
  341.             {
  342.                char.xspeed -= char.walkSpeed;
  343.                char._xscale = 100;
  344.                walkin = true;
  345.             }
  346.             else if(Key.isDown(39))
  347.             {
  348.                char.xspeed += char.walkSpeed;
  349.                char._xscale = -100;
  350.                walkin = true;
  351.             }
  352.             moveChar(char);
  353.          }
  354.          else
  355.          {
  356.             if(typeof char.fighting == "number")
  357.             {
  358.                char.fighting--;
  359.                if(char.fighting < 0)
  360.                {
  361.                   char.fighting = undefined;
  362.                }
  363.             }
  364.             else if(char.fighting == undefined or char.fighting.currentAction == "die" or !random(20))
  365.             {
  366.                closestDist = Infinity;
  367.                closest = undefined;
  368.                chars = [];
  369.                for(ch2 in activeChars)
  370.                {
  371.                   char2 = activeChars[ch2];
  372.                   if(char2 !== char and char2.currentAction !== "die" and char2.team !== char.team)
  373.                   {
  374.                      dist = Math.abs(char2.x - char.x) + Math.abs(char2.y - char.y);
  375.                      chars.push(char2);
  376.                      if(dist < closestDist)
  377.                      {
  378.                         closestDist = dist;
  379.                         closest = char2;
  380.                      }
  381.                   }
  382.                }
  383.                if(closestDist > 200 and !random(4))
  384.                {
  385.                   char.fighting = random(40);
  386.                }
  387.                else
  388.                {
  389.                   char.fighting = chars[random(chars.length)];
  390.                }
  391.             }
  392.             phase = (Math.cos(getTimer() / 2000) + 1) * 40;
  393.             if(char.health < phase and (char.fighting.currentAction == "attack1" or !char.fighting.waitForAnimation and (char.x >= char.fighting.x ? char.fighting._xscale < 0 : char.fighting._xscale > 0)))
  394.             {
  395.                char.standoff = true;
  396.                xbuffer = 150;
  397.                ybuffer = 20;
  398.             }
  399.             else
  400.             {
  401.                char.standoff = false;
  402.                xbuffer = 60;
  403.                ybuffer = 10;
  404.             }
  405.             walkin = false;
  406.             if(char.x < char.fighting.x - xbuffer)
  407.             {
  408.                char._xscale = -100;
  409.                char.xspeed += char.walkSpeed;
  410.                walkin = true;
  411.             }
  412.             else if(char.x > char.fighting.x + xbuffer)
  413.             {
  414.                char._xscale = 100;
  415.                char.xspeed -= char.walkSpeed;
  416.                walkin = true;
  417.             }
  418.             else
  419.             {
  420.                diff = Math.abs(char.x - char.fighting.x);
  421.                if(diff < xbuffer / 2)
  422.                {
  423.                   walkin = true;
  424.                   if(char.x > char.fighting.x)
  425.                   {
  426.                      char.xspeed += char.walkSpeed / 2;
  427.                      char._xscale = -100;
  428.                   }
  429.                   else
  430.                   {
  431.                      char.xspeed -= char.walkSpeed / 2;
  432.                      char._xscale = 100;
  433.                   }
  434.                }
  435.                else if(char.x > char.fighting.x)
  436.                {
  437.                   char._xscale = 100;
  438.                }
  439.                else
  440.                {
  441.                   char._xscale = -100;
  442.                }
  443.             }
  444.             if(char.y < char.fighting.y - ybuffer)
  445.             {
  446.                char.yspeed += char.walkSpeed;
  447.                walkin = true;
  448.             }
  449.             else if(char.y > char.fighting.y + ybuffer)
  450.             {
  451.                char.yspeed -= char.walkSpeed;
  452.                walkin = true;
  453.             }
  454.             moveChar(char);
  455.             if(!walkin and char.fighting !== undefined and !char.standoff and typeof char.fighting == "movieclip")
  456.             {
  457.                if(!random(5))
  458.                {
  459.                   if(char.airborne)
  460.                   {
  461.                      if(char.z > char.fighting.z || char.z < char.fighting.z - 60)
  462.                      {
  463.                         char.gotoAndPlay("airattack");
  464.                      }
  465.                   }
  466.                   else
  467.                   {
  468.                      char.gotoAndPlay("attack1");
  469.                   }
  470.                   char.waitForAnimation = true;
  471.                   char.comboLvl = 1;
  472.                   char.xspeed = char.yspeed = 0;
  473.                }
  474.             }
  475.          }
  476.          overBlock = false;
  477.          for(ob in wallObjects)
  478.          {
  479.             obj = wallObjects[ob];
  480.             if(obj.contains(char.x,char.y))
  481.             {
  482.                if(char.z < wallHeight)
  483.                {
  484.                   if(obj.contains(oldpos.x,char.y))
  485.                   {
  486.                      char.y = oldpos.y;
  487.                   }
  488.                   if(obj.contains(char.x,oldpos.y))
  489.                   {
  490.                      char.x = oldpos.x;
  491.                   }
  492.                   if(char !== playerCharacter)
  493.                   {
  494.                      if(!char.airborne)
  495.                      {
  496.                         char.zspeed += char.jumpPower;
  497.                         char.airborne = true;
  498.                      }
  499.                   }
  500.                }
  501.                else
  502.                {
  503.                   overBlock = true;
  504.                }
  505.             }
  506.          }
  507.          groundheight = !overBlock ? 0 : wallHeight;
  508.          if(!char.waitForAnimation)
  509.          {
  510.             if(char.z > groundheight)
  511.             {
  512.                char.gotoAndStop("jump");
  513.             }
  514.             else if(walkin)
  515.             {
  516.                if(char.currentAction !== "run")
  517.                {
  518.                   char.gotoAndPlay("run");
  519.                }
  520.             }
  521.             else
  522.             {
  523.                char.gotoAndStop("stand");
  524.             }
  525.          }
  526.       }
  527.       else
  528.       {
  529.          oldpos = {x:char.x,y:char.y};
  530.          moveChar(char);
  531.          overBlock = false;
  532.          for(ob in wallObjects)
  533.          {
  534.             obj = wallObjects[ob];
  535.             if(obj.contains(char.x,char.y))
  536.             {
  537.                if(char.z < wallHeight)
  538.                {
  539.                   if(obj.contains(oldpos.x,char.y))
  540.                   {
  541.                      char.y = oldpos.y;
  542.                      char.yspeed *= -1;
  543.                   }
  544.                   if(obj.contains(char.x,oldpos.y))
  545.                   {
  546.                      char.x = oldpos.x;
  547.                      char.xspeed *= -1;
  548.                   }
  549.                }
  550.                else
  551.                {
  552.                   overBlock = true;
  553.                }
  554.             }
  555.          }
  556.          if(char.attack)
  557.          {
  558.             char.attack = false;
  559.             for(ch2 in activeChars)
  560.             {
  561.                char2 = activeChars[ch2];
  562.                if(char2 !== char and char2.team !== char.team and char2.currentAction !== "die")
  563.                {
  564.                   if(Math.abs(char2.z - char.z) < 60)
  565.                   {
  566.                      pt = new flash.geom.Point(char2._x,char2._y);
  567.                      game.localToGlobal(pt);
  568.                      if(char.hit.hitTest(pt.x,pt.y,false))
  569.                      {
  570.                         if(char !== playerCharacter)
  571.                         {
  572.                            char.comboLvl = char.comboLvl + 1;
  573.                         }
  574.                         if(char2.boss == true and char2.currentAction == "attack1")
  575.                         {
  576.                            char.gotoAndPlay("recoil");
  577.                            char.zspeed = 15;
  578.                         }
  579.                         else if(char2.currentAction == "block")
  580.                         {
  581.                            char.gotoAndPlay("recoil");
  582.                            char.zspeed = 15;
  583.                         }
  584.                         else if(!random(!char2.standoff ? 12 : 2) and (char.x >= char.fighting.x ? char.fighting._xscale < 0 : char.fighting._xscale > 0))
  585.                         {
  586.                            char2.gotoAndPlay("block");
  587.                            char.gotoAndPlay("recoil");
  588.                            char.zspeed = 15;
  589.                         }
  590.                         else
  591.                         {
  592.                            char2.fighting = char;
  593.                            battlesound.attachSound("swordsound" + random(3));
  594.                            battlesound.start();
  595.                            char2.health -= char.str * (1 + char.att / 100) * (1 - char2.def / 200);
  596.                            if(so.data.godmode)
  597.                            {
  598.                               playerCharacter.health = 100;
  599.                            }
  600.                            if(char == playerCharacter)
  601.                            {
  602.                               playerMoney += Math.floor(char.str * (1 + char2.def / 30));
  603.                            }
  604.                            if(char2.health > 0)
  605.                            {
  606.                               char2.healthbar._xscale = char2.health;
  607.                               char2.gotoAndPlay("recoil");
  608.                            }
  609.                            else
  610.                            {
  611.                               switch(battleMode)
  612.                               {
  613.                                  case "elimination":
  614.                                     char.points--;
  615.                                     _root["pts" + char.charnum] = char.points;
  616.                                     if(char.points == 0)
  617.                                     {
  618.                                        winningteam = char.team;
  619.                                        if(winningteam == playerCharacter.team)
  620.                                        {
  621.                                           battleProgress++;
  622.                                           playerMoney += 100 * battleProgress;
  623.                                           closeGame();
  624.                                           win.play();
  625.                                        }
  626.                                        else
  627.                                        {
  628.                                           lose.play();
  629.                                        }
  630.                                        delete game.onEnterFrame;
  631.                                        blackscreen._alpha = -100;
  632.                                        blackscreen._visible = true;
  633.                                        blackscreen.onEnterFrame = function()
  634.                                        {
  635.                                           blackscreen._alpha += 3;
  636.                                           if(blackscreen._alpha >= 100)
  637.                                           {
  638.                                              _root.gotoAndStop("prebattle");
  639.                                           }
  640.                                        };
  641.                                     }
  642.                                     break;
  643.                                  case "survival":
  644.                                     char2.points--;
  645.                                     _root["pts" + char2.charnum] = char2.points;
  646.                                     enpts = 0;
  647.                                     for(ch3 in activeChars)
  648.                                     {
  649.                                        if(activeChars[ch3].team !== char.team)
  650.                                        {
  651.                                           enpts += activeChars[ch3].points;
  652.                                        }
  653.                                     }
  654.                                     if(!enpts)
  655.                                     {
  656.                                        winningteam = char.team;
  657.                                        if(winningteam == playerCharacter.team)
  658.                                        {
  659.                                           battleProgress++;
  660.                                           if(so.data.furthest == undefined)
  661.                                           {
  662.                                              so.data.furthest = 0;
  663.                                           }
  664.                                           so.data.furthest = battleProgress <= so.data.furthest ? so.data.furthest : battleProgress;
  665.                                           if(battleProgress == battles.length)
  666.                                           {
  667.                                              gotoAndStop("outro");
  668.                                              if(so.data.timesFinished)
  669.                                              {
  670.                                                 so.data.timesFinished = so.data.timesFinished + 1;
  671.                                              }
  672.                                              else
  673.                                              {
  674.                                                 so.data.timesFinished = 1;
  675.                                              }
  676.                                           }
  677.                                           so.data.flush();
  678.                                           playerMoney += 100 * battleProgress;
  679.                                           closeGame();
  680.                                           win.play();
  681.                                        }
  682.                                        else
  683.                                        {
  684.                                           lose.play();
  685.                                        }
  686.                                        blackscreen._alpha = -100;
  687.                                        blackscreen._visible = true;
  688.                                        blackscreen.onEnterFrame = function()
  689.                                        {
  690.                                           blackscreen._alpha += 3;
  691.                                           if(blackscreen._alpha >= 100)
  692.                                           {
  693.                                              _root.gotoAndStop("prebattle");
  694.                                           }
  695.                                        };
  696.                                     }
  697.                               }
  698.                               char2.healthbar._xscale = 0;
  699.                               char2.gotoAndPlay("die");
  700.                               char2.currentAction = "die";
  701.                               char.fighting = undefined;
  702.                            }
  703.                            char2.waitForAnimation = true;
  704.                            if(char.knockback)
  705.                            {
  706.                               char.fighting = undefined;
  707.                               char2.zspeed = 30;
  708.                               if(char2.x < char.x)
  709.                               {
  710.                                  char2._xscale = -100;
  711.                                  char2.xspeed = -60;
  712.                               }
  713.                               else
  714.                               {
  715.                                  char2._xscale = 100;
  716.                                  char2.xspeed = 60;
  717.                               }
  718.                            }
  719.                            else
  720.                            {
  721.                               char2.zspeed = 15;
  722.                               if(char2.x < char.x)
  723.                               {
  724.                                  char2._xscale = -100;
  725.                               }
  726.                               else
  727.                               {
  728.                                  char2._xscale = 100;
  729.                               }
  730.                            }
  731.                         }
  732.                      }
  733.                   }
  734.                }
  735.             }
  736.             char.knockback = false;
  737.          }
  738.       }
  739.       aspect = 0.5 - playerCharacter.z / 1000;
  740.       dist = Math.sqrt(Math.pow(char.x,2) + Math.pow(char.y,2));
  741.       myrad = r + Math.atan2(char.y,char.x);
  742.       myc = Math.cos(myrad);
  743.       mys = Math.sin(myrad);
  744.       groundheight = !overBlock ? 0 : wallHeight;
  745.       if(char.zspeed !== 0 or char.z !== groundheight)
  746.       {
  747.          char.zspeed -= 6;
  748.          char.z += char.zspeed;
  749.          if(char.z <= groundheight)
  750.          {
  751.             char.z = groundheight;
  752.             char.zspeed = 0;
  753.             if(!char.waitForAnimation)
  754.             {
  755.                char.gotoAndPlay("land");
  756.             }
  757.             char.airborne = false;
  758.          }
  759.       }
  760.       char._x = myc * dist;
  761.       char._y = mys * dist * aspect - char.z;
  762.       char.shadow._x = char._x;
  763.       char.shadow._y = char._y + char.z;
  764.       char.shadow._xscale = 100 - char.z / 2;
  765.       if(char.shadow._xscale < 30)
  766.       {
  767.          char.shadow._xscale = 30;
  768.       }
  769.       char.shadow._yscale = char.shadow._xscale * aspect;
  770.       char.shadow.swapDepths(char.getDepth() - 1);
  771.       if(overBlock)
  772.       {
  773.          char.shadow._y -= wallHeight;
  774.       }
  775.       char.overBlock = overBlock;
  776.    }
  777.    for(wp in wallpanels)
  778.    {
  779.       panel = wallpanels[wp];
  780.       dist = Math.sqrt(Math.pow(panel.x,2) + Math.pow(panel.y,2));
  781.       myrad = r + Math.atan2(panel.y,panel.x);
  782.       panel._x = Math.cos(myrad) * dist;
  783.       panel._y = Math.sin(myrad) * dist * aspect;
  784.       rotate(panel,arenaRotation + panel.rot);
  785.    }
  786.    for(tp in toppanels)
  787.    {
  788.       panel = toppanels[tp];
  789.       dist = Math.sqrt(Math.pow(panel.x,2) + Math.pow(panel.y,2));
  790.       myrad = r + Math.atan2(panel.y,panel.x);
  791.       panel._parent._x = Math.cos(myrad) * dist;
  792.       panel._parent._y = Math.sin(myrad) * dist * aspect - wallHeight;
  793.       panel._rotation = arenaRotation;
  794.       panel._parent._yscale = 100 * aspect;
  795.    }
  796.    topRow = [];
  797.    frontRow = [];
  798.    middleRow = [];
  799.    backRow = [];
  800.    offstageRow = [];
  801.    for(ch in activeChars)
  802.    {
  803.       char = activeChars[ch];
  804.       if(char.overBlock)
  805.       {
  806.          topRow.push(char);
  807.       }
  808.       else if(Math.abs(char.x) <= char.y and char.y > 1)
  809.       {
  810.          frontRow.push(char);
  811.       }
  812.       else if(Math.abs(char.x) <= char.y + mapwide / 2 and char.y > (- mapwide) / 2)
  813.       {
  814.          middleRow.push(char);
  815.       }
  816.       else if(char.y >= (- mapwide) / 2)
  817.       {
  818.          backRow.push(char);
  819.       }
  820.       else
  821.       {
  822.          offstageRow.push(char);
  823.       }
  824.    }
  825.    topRow = sortDepths(topRow);
  826.    frontRow = sortDepths(frontRow);
  827.    middleRow = sortDepths(middleRow);
  828.    backRow = sortDepths(backRow);
  829.    offstageRow = sortDepths(offstageRow);
  830.    depthAr = offstageRow.concat([backWall],backRow,boxRear,middleRow,boxFront,frontRow,topRow);
  831.    depthcount = 1;
  832.    d = 0;
  833.    while(d < depthAr.length)
  834.    {
  835.       obj = depthAr[d];
  836.       obj.swapDepths((d + 1) * 2);
  837.       d++;
  838.    }
  839.    for(ch in activeChars)
  840.    {
  841.       char = activeChars[ch];
  842.       char.shadow.swapDepths(char.getDepth() - 1);
  843.    }
  844.    game._x = (Stage.width / 2 - playerCharacter._x + game._x * 5) / 6;
  845.    game._y = (Stage.height / 2 - playerCharacter._y + game._y * 5) / 6;
  846.    groundHolder._yscale = 100 * aspect;
  847. };
  848.