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

  1. function RedKey_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 RedKey_Loop()
  10. {
  11.    var x = 0;
  12.    this.cacheCX();
  13.    if(!(this.Obj_Flags & 0x40))
  14.    {
  15.       if(RedKey_Collide0(_root.Runner))
  16.       {
  17.          this.Obj_Target = _root.Runner;
  18.          x = 1;
  19.       }
  20.       if(RedKey_Collide0(_root.Fighter))
  21.       {
  22.          this.Obj_Target = _root.Fighter;
  23.          x = 1;
  24.       }
  25.       if(RedKey_Collide0(_root.Shield))
  26.       {
  27.          this.Obj_Target = _root.Shield;
  28.          x = 1;
  29.       }
  30.       if(x)
  31.       {
  32.          this.Obj_Flags |= 64;
  33.          this._visible = 0;
  34.          _root.snd.attachSound("LV_178");
  35.          _root.snd.start();
  36.       }
  37.    }
  38. }
  39. this.setHndlr(1,this.RedKey_Loop);
  40. this.gotoAndPlay("RedKey_Loop");
  41. _root.KEY_LT = 37;
  42. _root.KEY_RT = 39;
  43. _root.KEY_UP = 38;
  44. _root.KEY_DN = 40;
  45. _root.KEY_A = 65;
  46. _root.KEY_B = 83;
  47. _root.KEY_LB = 81;
  48. _root.KEY_RB = 87;
  49. _root.KEY_CHEAT = 17;
  50. _root.Obj_Flags_ALWAYSRUN = 384;
  51. _root.Obj_Flags_BACKGROUND = 256;
  52. _root.Obj_Flags_MICKEY = 128;
  53. _root.Obj_Flags_DEAD = 64;
  54. _root.Obj_Flags_SPECIAL = 32;
  55. _root.Obj_Flags_KILL = 16;
  56. _root.Obj_Flags_KEYBD = 8;
  57. _root.Obj_Flags_GONE = 4;
  58. _root.Obj_Flags_ATTACK = 2;
  59. _root.Obj_Flags_CLIMBING = 1;
  60. this.Obj_X1 = -5;
  61. this.Obj_X2 = 5;
  62. this.Obj_Y1 = -10;
  63. this.Obj_Y2 = 0;
  64.