My Pages

Saturday, 29 November 2014

Random Line Generator

Enter this code into BBC basic (demo or full) and it will create a random line generator. Go to super decade games for more code like this. (That's my teacher's webpage)

  
  rem Random Lines 
      mode 6: off

      colour 1 ,rnd(255),rnd(255),rnd(255)
      gcol 1
      x%=rnd(1200)
      y%=rnd (950)
      xa%=rnd(1200)
      ya%=rnd (950)

      line x%,y%,rnd(1200),rnd(950)
      repeat
  
        colour 1 ,rnd(255),rnd(255),rnd(255)
        gcol 1
  
        line x%,y%,xa%,ya%
  
        x%=xa%
        y%=ya%
        wait 5
        xa%=rnd(1200)
        ya%=rnd (950)
  
      until false