I just bought PB.

Just starting out? Need help? Post your questions and find answers here.
mag
Enthusiast
Enthusiast
Posts: 104
Joined: Mon Mar 29, 2004 1:46 pm

Post by mag »

I try something. recrution work. Great!!

Code: Select all

Procedure drawtree(x,y,ox,oy)
 For k=10 To 5 Step -1
  FrontColor(10,5,0) 
  a=Random(2)
  b=Random(20)
  Select a
  Case 1
   Line(x,y,b,k):ox=x:oy=y:x=x+b:y=y+k: 
   If x<500 And y<500
    drawtree(x,y,ox,oy)
   EndIf
  Case 2
   Line(x,y,k,b):ox=x:oy=y:x=x+k:y=y+b      
   If x<500 And y<500 
    drawtree(x,y,ox,oy)
   EndIf
  Default                                                    ;-) For you..
    If Random(3)=1
    FrontColor (Random(255),0,0 )
    Circle(x,y,5)
    FrontColor (Random(255),Random(255),0 )
    Circle(x+3,y+3,3)
    Circle(x-3,y-3,3)
    Circle(x-3,y+3,3)
    Circle(x+3,y-3,3)
    EndIf
    ProcedureReturn 
  EndSelect
 Next
EndProcedure 
RandomSeed(203) 
StartDrawing(WindowOutput())
drawtree(200,Random(200),0,0)
StopDrawing() 
Delay(1000)
ONLY FOR GIRL DOWN HERE ;)[/b]
Post Reply