Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Brick Pattern Fill Question
#1
I came upon this in Help. I like what it does, but don't get how it works. How do the CHR$(&H0)s and CHR$(&HEF)s create the string pattern to be filled? I understand the &H definition in Help is hex base 16 format, but that's as far as I go... Thanks!

DIM Row$(1 TO 8)
SCREEN 12

'make red-brick wall
Row$(1) = CHR$(&H0) + CHR$(&H0) + CHR$(&HFE) + CHR$(&HFE)
Row$(2) = Row$(1)
Row$(3) = Row$(1)
Row$(4) = CHR$(&H0) + CHR$(&H0) + CHR$(&H0) + CHR$(&H0)
Row$(5) = CHR$(&H0) + CHR$(&H0) + CHR$(&HEF) + CHR$(&HEF)
Row$(6) = Row$(5)
Row$(7) = Row$(5)
Row$(8) = Row$(4)
Tile$ = Row$(1) + Row$(2) + Row$(3) + Row$(4) + Row$(5) + Row$(6) + Row$(7) + Row$(8)

LINE (59, 124)-(581, 336), 14, B 'yellow box border to paint inside
PAINT (320, 240), Tile$, 14 'paints brick tiles within yellow border
Reply
#2
Screen 12 is a 256 color screen, so each of those CHR$ characters are a color.

CHR$(0) = Black.
CHR$(?? -- translate that hex) = Brick Orange-Red

BBOO
BBOO
BBOO
BBBB
BBOO
BBOO
BBOO
BBBB

And repeat that for the fill pattern.
Reply
#3
(May need to rotate it 90 degrees as screens are read down then right instead of right then down.)
Reply
#4
(12-01-2023, 07:37 PM)SMcNeill Wrote: (May need to rotate it 90 degrees as screens are read down then right instead of right then down.)
OK, gotcha. Thanks!
Reply




Users browsing this thread: 1 Guest(s)