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

  1. function Arrow_Shoot_Collide()
  2. {
  3.    var i;
  4.    var y;
  5.    var x1;
  6.    var x2;
  7.    x1 = (this.Obj_X >> 16) + this.Obj_X1 & 4294967288;
  8.    x2 = (this.Obj_X >> 16) + this.Obj_X2 & 4294967288;
  9.    y = this.Obj_Y >> 16 & 4294967288;
  10.    if(this.Obj_Flip < 0)
  11.    {
  12.       i = y / 8 * 102 + x1 / 8;
  13.    }
  14.    else
  15.    {
  16.       i = y / 8 * 102 + x2 / 8;
  17.    }
  18.    if(_root.CMapArray[i] == 1)
  19.    {
  20.       return 1;
  21.    }
  22.    return 0;
  23. }
  24. function Arrow_Shoot_Loop()
  25. {
  26.    this.Obj_X += 524288 * this.Obj_Flip;
  27.    this.Obj_Timer--;
  28.    this.cacheCX();
  29.    this.updateCache();
  30.    if(this.Obj_Timer == 0)
  31.    {
  32.       _root.Arrow = 0;
  33.       this.kill();
  34.    }
  35.    if(Arrow_Shoot_Collide() || this.Obj_Flags & 0x40)
  36.    {
  37.       _root.Arrow = 0;
  38.       _root.snd.attachSound("LV_225");
  39.       _root.snd.start();
  40.       this.gotoAndPlay("Arrow_Hit");
  41.    }
  42. }
  43. this.setHndlr(1,this.Arrow_Shoot_Loop);
  44. this.gotoAndPlay("Arrow_Shoot_Loop");
  45. _root.KEY_LT = 37;
  46. _root.KEY_RT = 39;
  47. _root.KEY_UP = 38;
  48. _root.KEY_DN = 40;
  49. _root.KEY_A = 65;
  50. _root.KEY_B = 83;
  51. _root.KEY_LB = 81;
  52. _root.KEY_RB = 87;
  53. _root.KEY_CHEAT = 17;
  54. _root.Obj_Flags_ALWAYSRUN = 384;
  55. _root.Obj_Flags_BACKGROUND = 256;
  56. _root.Obj_Flags_MICKEY = 128;
  57. _root.Obj_Flags_DEAD = 64;
  58. _root.Obj_Flags_SPECIAL = 32;
  59. _root.Obj_Flags_KILL = 16;
  60. _root.Obj_Flags_KEYBD = 8;
  61. _root.Obj_Flags_GONE = 4;
  62. _root.Obj_Flags_ATTACK = 2;
  63. _root.Obj_Flags_CLIMBING = 1;
  64. this.Obj_X1 = -10;
  65. this.Obj_X2 = 10;
  66. this.Obj_Y1 = -2;
  67. this.Obj_Y2 = 2;
  68. this.Obj_Timer = 32;
  69.