Advertisement
ZoriaRPG

Enemy Laser EWeapon Script v2

Oct 28th, 2019
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.70 KB | None | 0 0
  1. #include "std.zh"
  2.  
  3.     eweapon script laz
  4.     {
  5.         void run
  6.         (   int speed, int colour, int layer, int fizzlesfx,
  7.             int fizzlesprite, int shotsfx, int maxDist
  8.         )
  9.         {
  10.             int startX = CenterX(this);
  11.             int startY = CenterY(this);
  12.             this->Angular = true;
  13.             Audio->PlaySound(shotsfx); //because enemy editor shot sound isn't variable yet
  14.             this->Angle = ArcTan(Link->X-this->X, Link->Y-this->Y);
  15.             this->Step = speed;
  16.             /*  this->Damage = Game->LoadNPCData(this->Parent)->WeaponDamage;
  17.                 should get bthis from the enemy editor
  18.             */
  19.             this->DrawYOffset = -32768;
  20.             while(1)
  21.             {
  22.                 if
  23.                 ( Screen->isSolid(CenterX(this), CenterY(this))
  24.                         /*|| ( Distance(startX, startY, CenterX(this), CenterY(this)) > maxDist )*/
  25.                 )
  26.                 {
  27.                     this->DeadState = WDS_DEAD;
  28.                     Audio->PlaySound(fizzlesfx);
  29.                     if(fizzlesprite)
  30.                     {
  31.                        
  32.                         lweapon fiz = Screen->CreateLWeapon(LW_SPARKLE);
  33.                         fiz->UseSprite(fizzlesprite);
  34.                         fiz->CollDetection = false;
  35.                         fiz->X = this->X;
  36.                         fiz->Y = this->Y;
  37.                     }
  38.                 }
  39.                 else
  40.                 {
  41.                 //printf("parent->X: %d\n", Screen->LoadNPCByUID(this->ParentUID)->X);
  42.                     Screen->Line
  43.                     (   layer, Screen->LoadNPCByUID(this->ParentUID)->DrawXOffset
  44.                         + Screen->LoadNPCByUID(this->ParentUID)->X
  45.                         + ((Screen->LoadNPCByUID(this->ParentUID)->TileWidth)*8),
  46.                         Screen->LoadNPCByUID(this->ParentUID)->DrawYOffset
  47.                         + Screen->LoadNPCByUID(this->ParentUID)->Y
  48.                         + ((Screen->LoadNPCByUID(this->ParentUID)->TileHeight)*8),
  49.                         CenterX(this), CenterY(this), colour, 1, 0, 0, 0, 128
  50.                     );
  51.                 }
  52.                 Waitframe();
  53.             }
  54.         }
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement