Post by B+ on Apr 1, 2018 22:03:46 GMT
When posting code here, use the BBC tab when pasting it into the editor into code block.
If you use the preview tab (default), the code will come out double spaced in the post.
Notice the following code is NOT Double Spaced!
If you use the preview tab (default), the code will come out double spaced in the post.
Notice the following code is NOT Double Spaced!
'doBoxAgain tsh block mod.txt
'tsh73 adds shaddowing!
nomainwin
WindowWidth = 640
WindowHeight = 650
open "doBoxAgain" for graphics as #main ' < open graphics window for drawing in it
#main, "down; fill white; flush" ' < initial stuff
#main, "trapclose [quit.main]" ' < close window directions
#main, "backcolor 220 220 0" ' < backcolor is fill color for boxes yellow/green
call doBoxAgain 300, 300, 250 ' < this calls recursive sub which takes over drawing
wait ' < done so wait until close window
[quit.main]
close #main
end
sub doBoxAgain x, y, side ' < this is recursive sub, it calls itself over and over
scan ' < this allows exit in case I screwed up and made infinite loop
cx=x-side/2:cy=y-side/2 ' < this calcs place to start for pen
#main, "backcolor 40 80 80" ' gray
#main, "place ";cx+2;" ";cy+3 ' 3d
#main, "boxfilled ";cx+side+2;" ";cy+side+3 ' shadow
#main, "backcolor 220 220 0" 'restore color
#main, "place ";cx;" ";cy ' < this puts the pen at this place
#main, "boxfilled ";cx+side;" ";cy+side ' < this tells pen to draw box giving it the opposite corner location
if side<15 then exit sub ' < this tells when to quit recursive calls
ns=side/2 ' < this resets side length for next recursive calls
call doBoxAgain cx,cy,ns
call doBoxAgain cx+side,cy,ns
call doBoxAgain cx,cy+side,ns
call doBoxAgain cx+side,cy+side,ns
end sub