Advertisement
Sorceress

Untitled

May 14th, 2016
535
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dir = irandom(1)
  2. if dir = 0 xdir = choose(-1,1) else xdir = 0
  3. if dir = 1 ydir = choose(-1,1) else ydir = 0
  4.  
  5. for (i = 0 ; i < rNumber-1 ; i++) {
  6.  
  7.     if xpos > 0 and xpos < rmax xpos = xpos+xdir else xpos = xpos+0
  8.     if ypos > 0 and ypos < rmax ypos = ypos+ydir else ypos = ypos+0
  9.  
  10.     turn = irandom(2)
  11.     if turn = 1 { temp = xdir ; xdir = -ydir ; ydir = temp }
  12.     if turn = 2 { temp = ydir ; ydir = -xdir ; xdir = temp }
  13.  
  14.     if ds_grid_get(mainGrid, xpos+xdir, ypos+ydir) != 1 {
  15.         ds_grid_set(mainGrid, xpos+xdir, ypos+ydir, 1)
  16.         count +=1
  17.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement