Advertisement
ZoriaRPG

Link Active Script, Flicker When Hit

Feb 14th, 2019
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. link script FlickerWhenHit_Active
  2. {
  3.     void run()
  4.     {
  5.         int frame = 0;
  6.         while(Link->HP > 0) //If Link was hurt by anything.
  7.         {
  8.             ++frame;  //frame 1 starts immediately.
  9.            
  10.             //every game loop, frame will increase by '1', and will eventually roll over.
  11.            
  12.             //do things base on the frame timer:
  13.             if ( frame&1 && Game->DCounter[CR_LIFE] ) //if the frame is odd
  14.             {
  15.                 //flicker Link
  16.                 Link->Invisible = true;
  17.             }
  18.             else //the frame is even
  19.             {              
  20.                 Link->Invisible = false;
  21.             }
  22.            
  23.             if ( frame > 100000 ) //no need to constantly check
  24.             {
  25.                 //reset to 1
  26.                 frame = 1;
  27.                 //now we won't roll over
  28.             }
  29.            
  30.             Waitdraw();
  31.             Waitframe();
  32.         }
  33.         Link->Invisible = false; //clear this status if he is dying, and we'll run his onDeath script.
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement