ZoriaRPG

Simple Somaria v0.2

Jul 5th, 2018
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.06 KB | None | 0 0
  1. // Simple Somaria
  2. // ZoriaRPG
  3. // v0.2
  4.  
  5. ffc script SimpleSomariaBlock
  6. {
  7.     void run()
  8.     {
  9.         int pos; int x; int y; int blocks;
  10.         while(1)
  11.         {
  12.             switch(Link->Dir)
  13.             {
  14.                 //find best position for Link's midpoint
  15.                 case DIR_UP: { pos = ComboAt(Link->X+8, Link->Y+8)); break;}
  16.                 case DIR_DOWN: { pos = ComboAt(Link->X+7, Link->Y+8)); break;}
  17.                 case DIR_LEFT: { pos = ComboAt(Link->X+8, Link->Y+7)); break;}
  18.                 case DIR_RIGHT: { pos = ComboAt(Link->X+8, Link->Y+8)); break;}
  19.                
  20.             }
  21.             pos = AdjacentCombo(pos, Link->Dir); //update
  22.             x = ComboX(pos);
  23.             y = ComboY(pos);
  24.             if ( pos <= 0 ) //illegal pos. We should block the other corners, too.
  25.             {
  26.                 //error out
  27.             }
  28.             if ( Screen->ComboS[pos] != 0 )
  29.             {
  30.                 //error out
  31.             }
  32.             else
  33.             {
  34.                 if ( blocks )
  35.                 {
  36.                     //find and destroy old block
  37.                     //we obviously need to mark them in some way when they move!!
  38.                     //no, just a unique combo ID.
  39.                     for ( int q = 0; q < 176; ++q )
  40.                     {
  41.                         if ( Screen->ComboD[q] == CMB_SOMARIA )
  42.                         {
  43.                             //poof anim
  44.                             lweapon poof = Screen->CreateLWeapon(LW_SPARKLE);
  45.                             poof->X = x;
  46.                             poof->Y = y;
  47.                             poof->UseSprite(SPR_SOMARIA_POOF);
  48.                             //sound
  49.                             Game->PlaySound(SFX_SOMARIA_POOF);
  50.                             //remove block
  51.                             Screen->ComboD[pos] = Screen->Undercombo;
  52.                             --blocks;
  53.                             while(poof->isValid()) Waitframe();
  54.                             break;
  55.                         }
  56.                     }
  57.                            
  58.                    
  59.                     //create new block
  60.                 }
  61.                
  62.                 //Creaqte the block.
  63.                
  64.                 //set combo type to a 4-way block
  65.                
  66.                 //poof anim
  67.                 lweapon poof = Screen->CreateLWeapon(LW_SPARKLE);
  68.                 poof->X = x;
  69.                 poof->Y = y;
  70.                 poof->UseSprite(SPR_SOMARIA_POOF);
  71.                 //sound
  72.                 Game->PlaySound(SFX_SOMARIA_POOF);
  73.                 ComboD[pos] = CMB_SOMARIA; //must be a 4-way push type, and only used by this script.
  74.                 ++blocks;
  75.                    
  76.                
  77.             }
  78.             Waitframe();
  79.         }
  80.     }
  81. }
  82.            
  83.  
  84. item script SimpleSomariaCane
  85. {
  86.     void run()
  87.     {
  88.         Link->Action = LA_ATTACKING;
  89.         //if the ffc script isn't running, run it.
  90.         RunFFCScriptOrQuit("SimpleSomariaBlock");
  91.     }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment