Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dir = irandom(1)
- if dir = 0 xdir = choose(-1,1) else xdir = 0
- if dir = 1 ydir = choose(-1,1) else ydir = 0
- for (i = 0 ; i < rNumber-1 ; i++) {
- if xpos > 0 and xpos < rmax xpos = xpos+xdir else xpos = xpos+0
- if ypos > 0 and ypos < rmax ypos = ypos+ydir else ypos = ypos+0
- turn = irandom(2)
- if turn = 1 { temp = xdir ; xdir = -ydir ; ydir = temp }
- if turn = 2 { temp = ydir ; ydir = -xdir ; xdir = temp }
- if ds_grid_get(mainGrid, xpos+xdir, ypos+ydir) != 1 {
- ds_grid_set(mainGrid, xpos+xdir, ypos+ydir, 1)
- count +=1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement