Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
request for printing patterns with for loops tutorial
#12
@fistfullofnails You can "Print patterns" on Screen 0, the default screen (when Screen is not called in code), simply by changing colors and printing a space = " ". A space ONLY prints the background color AND can be used to clear text on a line instead of CLS so you can erase parts of screen without erasing everything.

There are 8 background colors in Screen 0 and here is a horizontal striped using color changes and printing spaces:
Code: (Select All)
For row = 1 To 25 ' the default = screen 0 has 25 rows  to put characters you type
    For col = 1 To 80 ' the default = screen 0 has 80 columns  to put characters you type
        ' you can color screen 0 simple by specifying a backcolor and printing a space
        Color , row Mod 8 ' a mod b divides a by b and return remainder a number between 0 & b-1 inclusive
        Locate row, col: Print " "; ' print a space at each location
    Next
Next

simply change
Color ,row, Mod 8
to
Color , col, Mod 8

and the horizontal stripes become vertical!
Code: (Select All)
For row = 1 To 25 ' the default = screen 0 has 25 rows  to put characters you type
    For col = 1 To 80 ' the default = screen 0 has 80 columns  to put characters you type
        ' you can color screen 0 simple by specifying a backcolor and printing a space
        Color , col Mod 8 ' a mod b divides a by b and return remainder a number between 0 & b-1 inclusive
        Locate row, col: Print " "; ' print a space at each location
    Next
Next
b = b + ...
Reply


Messages In This Thread
RE: request for printing patterns with for loops tutorial - by bplus - 11-21-2024, 02:30 PM



Users browsing this thread: 1 Guest(s)