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

  1. function YellowHole_Collide0(target)
  2. {
  3.    if(target.CX2 < this.CX1 || target.CX1 > this.CX2 || target.CY2 < this.CY1 || target.CY1 > this.CY2)
  4.    {
  5.       return 0;
  6.    }
  7.    return 1;
  8. }
  9. function YellowHole_Loop()
  10. {
  11.    this.Obj_Climb = this.Obj_Climb + 1;
  12.    if(this.Obj_Climb & 3)
  13.    {
  14.       this.CX1 = (this.Obj_X >> 16) + this.Obj_X1;
  15.       this.CX2 = (this.Obj_X >> 16) + this.Obj_X2;
  16.       this.CY1 = (this.Obj_Y >> 16) + this.Obj_Y1;
  17.       this.CY2 = (this.Obj_Y >> 16) + this.Obj_Y2;
  18.       if(!(this.Obj_Flags & 0x40))
  19.       {
  20.          var x;
  21.          if(_root.YellowKey.Obj_Target == _root.Runner)
  22.          {
  23.             x |= YellowHole_Collide0(_root.Runner);
  24.          }
  25.          if(_root.YellowKey.Obj_Target == _root.Fighter)
  26.          {
  27.             x |= YellowHole_Collide0(_root.Fighter);
  28.          }
  29.          if(_root.YellowKey.Obj_Target == _root.Shield)
  30.          {
  31.             x |= YellowHole_Collide0(_root.Shield);
  32.          }
  33.          if(x && this.Keys_state[4] & _root.Bits_on[6])
  34.          {
  35.             _root.YellowKey.Obj_Target = 0;
  36.             this.Obj_Flags |= 64;
  37.             this._visible = 0;
  38.             _root.Door4.Obj_Timer = 0;
  39.             _root.snd.attachSound("LV_199");
  40.             _root.snd.start();
  41.          }
  42.       }
  43.    }
  44. }
  45. this.setHndlr(1,this.YellowHole_Loop);
  46. this.gotoAndPlay("YellowHole_Loop");
  47. _root.KEY_LT = 37;
  48. _root.KEY_RT = 39;
  49. _root.KEY_UP = 38;
  50. _root.KEY_DN = 40;
  51. _root.KEY_A = 65;
  52. _root.KEY_B = 83;
  53. _root.KEY_LB = 81;
  54. _root.KEY_RB = 87;
  55. _root.KEY_CHEAT = 17;
  56. _root.Obj_Flags_ALWAYSRUN = 384;
  57. _root.Obj_Flags_BACKGROUND = 256;
  58. _root.Obj_Flags_MICKEY = 128;
  59. _root.Obj_Flags_DEAD = 64;
  60. _root.Obj_Flags_SPECIAL = 32;
  61. _root.Obj_Flags_KILL = 16;
  62. _root.Obj_Flags_KEYBD = 8;
  63. _root.Obj_Flags_GONE = 4;
  64. _root.Obj_Flags_ATTACK = 2;
  65. _root.Obj_Flags_CLIMBING = 1;
  66. this.Obj_X1 = -10;
  67. this.Obj_X2 = 10;
  68. this.Obj_Y1 = -10;
  69. this.Obj_Y2 = 0;
  70.