Advertisement
ZoriaRPG

ZScript: Scripted Hookshot / Double Clawshot (Pre-Alpha)

Nov 25th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. //Scripted Hookshot
  2.  
  3. const int LW_HOOKSHOT2 = 31; //Script type
  4. const int CHAIN_DELAY = 10; //10 frames.
  5. const int DRAG_LINK_DELAY = 10;
  6. ffc script Hookshot{
  7.     void run(int length){
  8.         int q[8];
  9.             lweapon l;
  10.             int cmb; int startx; int starty; int linktimer = DRAG_LINK_DELAY;
  11.         startx = Link->X;
  12.             starty = Link->Y;
  13.         int chaintimer = CHAIN_DELAY;
  14.        
  15.         l = Screen->CreateLWeapon(LW_HOOKSHOT2);
  16.         l->X = Link->X; l->Y = Link->Y; //We will need to adjust these to be in front of Link, later.
  17.         while(true){
  18.            
  19.             //Facing up
  20.            
  21.             for ( q[0] = 0; [0] < length*16; q[0]++ ){
  22.                
  23.                 l->Dir = Link->Dir;
  24.                 //flips
  25.                 l->Step = 160; //We want it to move 4 tile s per second, or something like that
  26.                 l->Y--;
  27.                 if ( ( starty - l->Y ) % 8 ) {
  28.                     for ( q[1] = starty; q[1] > l->X+8; q[1] -= 8 ){
  29.                         if ( chaintimer > 0 ) chaintimer--;
  30.                         if ( chaintimer <= 0 ) {
  31.                             //Draw chain tiles
  32.                         }
  33.                        
  34.                     }
  35.                 }
  36.                 if ( l->Y <= 1 || ComboFI(ComboAt(l->X, l->Y), Screen->ComboT[ComboAt(l->X+8, l->Y+8) == CT_HOOKSHOTGRAB ){
  37.                     //stop drawing more tiles by stopping the momentum
  38.                     l->Step = 0;
  39.                     //Drag link to the target.
  40.                     while ( Link->Y < l->Y ) {
  41.                     //if ( Link->Y < l->Y ) {
  42.                         NoAction(); //We'll want to allow chaning his direction, and firing a second hookshot inthe future.
  43.                         if ( linktimer > 0 ) linktimer--;
  44.                         if ( linktimer <= 0 ) Link->Y--;
  45.                         //Draw chainsegments between Link and the hookshot head.
  46.                         for ( q[2] = Link->Y; q[2] < l->Y; q[2] += 8 ) {
  47.                             //Draw chain tile
  48.                         }
  49.                         Waitframe();
  50.                     }
  51.                    
  52.                 }
  53.             }
  54.             Waitframe();
  55.         }
  56.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement