Advertisement
Fastmapler

Generate floor

May 9th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. function doFloorThing(%x,%y)
  2. {
  3.     if (%x > 15)
  4.     {
  5.         %y++;
  6.         %x = 0;
  7.         shiftBrickTowards(1);
  8.         shiftBrickTowards(0);
  9.     }
  10.     if (%y > 15)
  11.     {
  12.         return;
  13.     }
  14.    
  15.     if (%y % 2 == 0)
  16.     {
  17.         shiftBrickRight(1);
  18.         shiftBrickRight(0);
  19.     }
  20.     else
  21.     {
  22.         shiftBrickLeft(1);
  23.         shiftBrickLeft(0);
  24.     }
  25.    
  26.     if ((getRandom(0,15) <= %y)) //Raise the 15 to make spawning less likely.
  27.     {
  28.         plantBrick(1);
  29.         plantBrick(0);
  30.     }
  31.        
  32.     schedule(50,0,"doFloorThing",%x+1,%y);
  33. }
  34.  
  35. function doFloorThingFast() //Faster, but may lag server
  36. {
  37.     for (%y=0;%y<16;%y++)
  38.     {
  39.         for (%x=0;%x<16;%x++)
  40.         {
  41.             if (%y % 2 == 0)
  42.             {
  43.                 shiftBrickRight(1);
  44.                 shiftBrickRight(0);
  45.             }
  46.             else
  47.             {
  48.                 shiftBrickLeft(1);
  49.                 shiftBrickLeft(0);
  50.             }
  51.            
  52.             if (getRandom(0,%y) == 0)
  53.                 plantBrick();
  54.         }
  55.         shiftBrickTowards(1);
  56.         shiftBrickTowards(0);
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement