home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Aventura / the_lost_vikings.swf / scripts / DefineSprite_212_FighterClass / frame_1 / DoAction.as
Encoding:
Text File  |  2007-03-20  |  10.0 KB  |  487 lines

  1. function Do_Fighter_Shoot()
  2. {
  3.    _root.Arrow = _root.Objs.create("ArrowClass",56,0,this.Obj_X,this.Obj_Y - 1114112,null);
  4.    _root.Arrow.Obj_Flip = this.Obj_Flip;
  5.    _root.snd.attachSound("LV_135");
  6.    _root.snd.start();
  7. }
  8. function Fighter_Walk()
  9. {
  10.    if(this.Keys_state[4] & _root.Bits_on[5])
  11.    {
  12.       if(this.Obj_DX > 0)
  13.       {
  14.          this.Obj_DX = 0;
  15.       }
  16.       this.Obj_DX += -32768;
  17.       if(this.Obj_DX < -393216)
  18.       {
  19.          this.Obj_DX = -393216;
  20.       }
  21.       this.Obj_Flip = -1;
  22.    }
  23.    else if(this.Keys_state[4] & _root.Bits_on[7])
  24.    {
  25.       if(this.Obj_DX < 0)
  26.       {
  27.          this.Obj_DX = 0;
  28.       }
  29.       this.Obj_DX += 32768;
  30.       if(this.Obj_DX > 393216)
  31.       {
  32.          this.Obj_DX = 393216;
  33.       }
  34.       this.Obj_Flip = 1;
  35.    }
  36.    else
  37.    {
  38.       this.Obj_DX = 0;
  39.       gotoAndPlay(49);
  40.    }
  41.    if(this.CX_Ladder("Fighter_Climb0"))
  42.    {
  43.       return undefined;
  44.    }
  45.    if(this.CX_LadderX("Fighter_Climb0"))
  46.    {
  47.       return undefined;
  48.    }
  49.    this.CX(0,32768,524288);
  50.    if(this.CX_Fall_Flag)
  51.    {
  52.       this.gotoAndPlay("Fighter_Fall");
  53.    }
  54.    if(this.CX_Collide_Flag & 3)
  55.    {
  56.       this.gotoAndPlay("Fighter_Push");
  57.    }
  58. }
  59. function Fighter_Idle()
  60. {
  61.    this.Obj_DX = 0;
  62.    if(0 && this.Keys_pressed[2] & _root.Bits_on[1])
  63.    {
  64.       this.gotoAndPlay("Fighter_Cheat");
  65.    }
  66.    if(this.Keys_state[4] & _root.Bits_on[5])
  67.    {
  68.       this.Obj_DX = -1;
  69.       gotoAndPlay(16);
  70.    }
  71.    else if(this.Keys_state[4] & _root.Bits_on[7])
  72.    {
  73.       this.Obj_DX = 1;
  74.       gotoAndPlay(16);
  75.    }
  76.    else if(this.Keys_state[8] & _root.Bits_on[1])
  77.    {
  78.       if(_root.MOT_random(0,99) > 50)
  79.       {
  80.          _root.snd.attachSound("LV_201");
  81.          _root.snd.start();
  82.          gotoAndPlay(136);
  83.       }
  84.       else
  85.       {
  86.          _root.snd.attachSound("LV_201");
  87.          _root.snd.start();
  88.          gotoAndPlay(159);
  89.       }
  90.    }
  91.    else if(this.Keys_state[10] & _root.Bits_on[3])
  92.    {
  93.       if(!_root.Arrow)
  94.       {
  95.          this.gotoAndPlay("Fighter_Shoot");
  96.       }
  97.    }
  98.    else if(this.Keys_pressed[4] & _root.Bits_on[6])
  99.    {
  100.       if(_root.teleportCheck(this))
  101.       {
  102.          this.gotoAndPlay("Fighter_Teleport");
  103.       }
  104.       _root.helpCheck(this);
  105.    }
  106.    if(this.CX_Ladder("Fighter_Climb0"))
  107.    {
  108.       return undefined;
  109.    }
  110.    if(this.CX_LadderX("Fighter_Climb0"))
  111.    {
  112.       return undefined;
  113.    }
  114.    this.CX(0,32768,524288);
  115.    if(this.CX_Fall_Flag)
  116.    {
  117.       this.gotoAndPlay("Fighter_Fall");
  118.    }
  119. }
  120. function Fighter_IdleA()
  121. {
  122.    this.Obj_DX = 0;
  123.    if(this.Keys_state[4] & _root.Bits_on[5])
  124.    {
  125.       this.Obj_Flip = -1;
  126.       gotoAndPlay(16);
  127.    }
  128.    else if(this.Keys_state[4] & _root.Bits_on[7])
  129.    {
  130.       this.Obj_Flip = 1;
  131.       gotoAndPlay(16);
  132.    }
  133.    if(this.CX_Ladder("Fighter_Climb0"))
  134.    {
  135.       return undefined;
  136.    }
  137.    if(this.CX_LadderX("Fighter_Climb0"))
  138.    {
  139.       return undefined;
  140.    }
  141.    this.CX(0,32768,524288);
  142.    if(this.CX_Fall_Flag)
  143.    {
  144.       this.gotoAndPlay("Fighter_Fall");
  145.    }
  146. }
  147. function Fighter_SwordA()
  148. {
  149.    this.CX(0,32768,524288);
  150.    if(this.CX_Fall_Flag)
  151.    {
  152.       this.gotoAndPlay("Fighter_Fall");
  153.    }
  154. }
  155. function Fighter_SwordB()
  156. {
  157.    this.CX(0,32768,524288);
  158.    if(this.CX_Fall_Flag)
  159.    {
  160.       this.gotoAndPlay("Fighter_Fall");
  161.    }
  162. }
  163. function Fighter_Climb_Frame()
  164. {
  165.    this.Obj_AnimFrame += 80;
  166.    switch(this.Obj_AnimFrame >> 8 & 3)
  167.    {
  168.       case 0:
  169.          this.gotoAndStop("Fighter_Climb1");
  170.          break;
  171.       case 1:
  172.          this.gotoAndStop("Fighter_Climb2");
  173.          break;
  174.       case 2:
  175.          this.gotoAndStop("Fighter_Climb3");
  176.          break;
  177.       case 3:
  178.          this.gotoAndStop("Fighter_Climb4");
  179.    }
  180. }
  181. function Fighter_Climb0()
  182. {
  183.    this.Obj_Flags |= 1;
  184.    if(this.Obj_Timer < 0)
  185.    {
  186.       this.Obj_Timer += 4;
  187.       this.Obj_X -= 262144;
  188.       if(this.Obj_X <= this.Obj_Target)
  189.       {
  190.          this.Obj_X = this.Obj_Target;
  191.       }
  192.    }
  193.    else if(this.Obj_Timer > 0)
  194.    {
  195.       this.Obj_Timer += 4;
  196.       this.Obj_X += 262144;
  197.       if(this.Obj_X >= this.Obj_Target)
  198.       {
  199.          this.Obj_X = this.Obj_Target;
  200.       }
  201.    }
  202.    if(this.Obj_X == this.Obj_Target)
  203.    {
  204.       if(this.Obj_Climb == 0)
  205.       {
  206.          this.gotoAndPlay("Fighter_Climb");
  207.       }
  208.       if(this.Obj_Climb == 1)
  209.       {
  210.          this.gotoAndPlay("Fighter_Climb_Out");
  211.       }
  212.    }
  213. }
  214. function Fighter_Climb()
  215. {
  216.    this.Obj_Flags |= 1;
  217.    this.Obj_DX = 0;
  218.    this.Obj_DY = 0;
  219.    if(this.Keys_state[4] & _root.Bits_on[6])
  220.    {
  221.       this.Obj_DY = -163840;
  222.       this.Fighter_Climb_Frame();
  223.    }
  224.    else if(this.Keys_state[5] & _root.Bits_on[0])
  225.    {
  226.       this.Obj_DY = 163840;
  227.       this.Fighter_Climb_Frame();
  228.    }
  229.    else if(this.Keys_state[4] & _root.Bits_on[5])
  230.    {
  231.       this.Obj_Flip = -1;
  232.       this.Obj_Flags &= 65534;
  233.       this.gotoAndPlay("Fighter_Fall");
  234.    }
  235.    else if(this.Keys_state[4] & _root.Bits_on[7])
  236.    {
  237.       this.Obj_Flip = 1;
  238.       this.Obj_Flags &= 65534;
  239.       this.gotoAndPlay("Fighter_Fall");
  240.    }
  241.    this.CX(0,0,1073741824);
  242.    if(!this.CX_Ladder0())
  243.    {
  244.       this.Obj_Flags &= 65534;
  245.       this.gotoAndPlay("Fighter_Climb_Out");
  246.    }
  247.    if(this.CX_Collide_Flag & 8)
  248.    {
  249.       this.Obj_Flags &= 65534;
  250.       this.gotoAndPlay("Fighter_Idle");
  251.    }
  252. }
  253. function Fighter_Climb_Out()
  254. {
  255.    this.Obj_DX = 0;
  256.    this.Obj_DY = 0;
  257.    if(this.Keys_state[4] & _root.Bits_on[6])
  258.    {
  259.       this.Obj_DY = -65536;
  260.    }
  261.    else if(this.Keys_state[5] & _root.Bits_on[0])
  262.    {
  263.       this.Obj_DY = 65536;
  264.    }
  265.    if((this.Obj_Y >> 16 & 7) < 4)
  266.    {
  267.       this.gotoAndStop("Fighter_Climb_Out1");
  268.    }
  269.    else
  270.    {
  271.       this.gotoAndStop("Fighter_Climb_Out2");
  272.    }
  273.    this.Obj_X += this.Obj_DX;
  274.    this.Obj_Y += this.Obj_DY;
  275.    if(!this.CX_LadderX0())
  276.    {
  277.       this.gotoAndPlay("Fighter_Idle");
  278.       if(this.CX_Ladder0())
  279.       {
  280.          this.gotoAndPlay("Fighter_Climb");
  281.       }
  282.       else
  283.       {
  284.          this.Obj_DX = 0;
  285.          this.Obj_DY = 0;
  286.          this.Obj_Y &= 4294443008;
  287.          this.Obj_Y += 458752;
  288.          this.gotoAndPlay("Fighter_Idle");
  289.       }
  290.    }
  291. }
  292. function Fighter_Fall()
  293. {
  294.    if(this.Keys_state[4] & _root.Bits_on[5])
  295.    {
  296.       this.Obj_DX += -32768;
  297.       if(this.Obj_DX < -393216)
  298.       {
  299.          this.Obj_DX = -393216;
  300.       }
  301.       this.Obj_Flip = -1;
  302.    }
  303.    else if(this.Keys_state[4] & _root.Bits_on[7])
  304.    {
  305.       this.Obj_DX += 32768;
  306.       if(this.Obj_DX > 393216)
  307.       {
  308.          this.Obj_DX = 393216;
  309.       }
  310.       this.Obj_Flip = 1;
  311.    }
  312.    else
  313.    {
  314.       this.Obj_DX = 0;
  315.    }
  316.    if(this.CX_Ladder("Fighter_Climb0"))
  317.    {
  318.       return undefined;
  319.    }
  320.    this.CX(0,32768,524288);
  321.    if(this.Obj_Y - this.Obj_Target >> 16 > 96)
  322.    {
  323.       this.gotoAndPlay("Fighter_FreeFall");
  324.    }
  325.    if(this.CX_Collide_Flag & 4)
  326.    {
  327.       this.Obj_DY = 0;
  328.    }
  329.    if(this.CX_Collide_Flag & 8)
  330.    {
  331.       _root.snd.attachSOund("LV_196");
  332.       _root.snd.start();
  333.       this.gotoAndPlay("Fighter_Idle");
  334.    }
  335. }
  336. function Fighter_FreeFall()
  337. {
  338.    this.Obj_DX = 0;
  339.    if(this.CX_Ladder("Fighter_Climb0"))
  340.    {
  341.       return undefined;
  342.    }
  343.    this.CX(0,32768,524288);
  344.    if(this.Obj_Y - this.Obj_Target >> 16 > 96)
  345.    {
  346.       this.gotoAndPlay("Fighter_FreeFall");
  347.    }
  348.    if(this.CX_Collide_Flag & 4)
  349.    {
  350.       this.Obj_DY = 0;
  351.    }
  352.    if(this.CX_Collide_Flag & 8)
  353.    {
  354.       _root.ImpactY_Flag = 9;
  355.       _root.snd.attachSound("LV_185");
  356.       _root.snd.start();
  357.       this.gotoAndPlay("Fighter_Crash");
  358.    }
  359. }
  360. function Fighter_Push()
  361. {
  362.    this.Obj_DX = 0;
  363.    if(this.Keys_state[4] & _root.Bits_on[5])
  364.    {
  365.       if(this.Obj_DX > 0)
  366.       {
  367.          this.Obj_DX = 0;
  368.       }
  369.       this.Obj_DX = -65536;
  370.       if(this.Obj_DX < -393216)
  371.       {
  372.          this.Obj_DX = -393216;
  373.       }
  374.       this.Obj_Flip = -1;
  375.    }
  376.    else if(this.Keys_state[4] & _root.Bits_on[7])
  377.    {
  378.       if(this.Obj_DX < 0)
  379.       {
  380.          this.Obj_DX = 0;
  381.       }
  382.       this.Obj_DX = 65536;
  383.       if(this.Obj_DX > 393216)
  384.       {
  385.          this.Obj_DX = 393216;
  386.       }
  387.       this.Obj_Flip = 1;
  388.    }
  389.    else
  390.    {
  391.       this.gotoAndPlay("Fighter_Idle");
  392.    }
  393.    this.CX(0,32768,524288);
  394.    if(!(this.CX_Collide_Flag & 3))
  395.    {
  396.       this.gotoAndPlay("Fighter_Idle");
  397.    }
  398. }
  399. function Fighter_Crash()
  400. {
  401.    this.CX(0,0,1073741824);
  402. }
  403. function Fighter_Shocked()
  404. {
  405. }
  406. function Fighter_Shoot()
  407. {
  408.    this.CX(0,32768,524288);
  409. }
  410. function Fighter_Cheat()
  411. {
  412.    if(this.Keys_pressed[2] & _root.Bits_on[1])
  413.    {
  414.       this.gotoAndPlay("Fighter_Fall");
  415.    }
  416.    if(this.Keys_state[4] & _root.Bits_on[6])
  417.    {
  418.       this.Obj_Y -= 524288;
  419.    }
  420.    if(this.Keys_state[5] & _root.Bits_on[0])
  421.    {
  422.       this.Obj_Y += 524288;
  423.    }
  424.    if(this.Keys_state[4] & _root.Bits_on[5])
  425.    {
  426.       this.Obj_Flip = -1;
  427.       this.Obj_X -= 524288;
  428.    }
  429.    if(this.Keys_state[4] & _root.Bits_on[7])
  430.    {
  431.       this.Obj_Flip = 1;
  432.       this.Obj_X += 524288;
  433.    }
  434.    this.cacheCX();
  435.    trace("x: " + (this.Obj_X >> 16) + ", y: " + (this.Obj_Y >> 16));
  436. }
  437. function Fighter_Teleport()
  438. {
  439. }
  440. function Fighter_Splat()
  441. {
  442. }
  443. function Fighter_Hit()
  444. {
  445.    this.Obj_Flags &= 65534;
  446.    this.Obj_X += this.Obj_DX;
  447.    if(this.Obj_DX < 0)
  448.    {
  449.       while(this.Ck_Collide_LF())
  450.       {
  451.       }
  452.    }
  453.    else if(this.Obj_DX > 0)
  454.    {
  455.       while(this.Ck_Collide_RT())
  456.       {
  457.       }
  458.    }
  459. }
  460. function Fighter_Die()
  461. {
  462. }
  463. this.gotoAndPlay("Fighter_Idle");
  464. _root.KEY_LT = 37;
  465. _root.KEY_RT = 39;
  466. _root.KEY_UP = 38;
  467. _root.KEY_DN = 40;
  468. _root.KEY_A = 65;
  469. _root.KEY_B = 83;
  470. _root.KEY_LB = 81;
  471. _root.KEY_RB = 87;
  472. _root.KEY_CHEAT = 17;
  473. _root.Obj_Flags_ALWAYSRUN = 384;
  474. _root.Obj_Flags_BACKGROUND = 256;
  475. _root.Obj_Flags_MICKEY = 128;
  476. _root.Obj_Flags_DEAD = 64;
  477. _root.Obj_Flags_SPECIAL = 32;
  478. _root.Obj_Flags_KILL = 16;
  479. _root.Obj_Flags_KEYBD = 8;
  480. _root.Obj_Flags_GONE = 4;
  481. _root.Obj_Flags_ATTACK = 2;
  482. _root.Obj_Flags_CLIMBING = 1;
  483. this.Obj_X1 = -5;
  484. this.Obj_X2 = 5;
  485. this.Obj_Y1 = -31;
  486. this.Obj_Y2 = 0;
  487.