Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
request for printing patterns with for loops tutorial
#3
Simpler thing:
Code: (Select All)
Screen _NewImage(400, 600, 32)

xc = 200
For i = 1 To 30
    _PrintString (xc - .5 * i * 8, i * 16 + 20), String$(i, "*")
Next
For i = 31 To 35
    _PrintString (xc - .5 * 2 * 8, i * 16 + 20), String$(2, "*")
Next
Sleep

xc = 200 ' center pixel
For i = 1 To 30 ' rows and strings of *
_PrintString (xc - .5 * i * 8, i * 16 + 20), String$(i, "*")
Next

_printstring (x, y), text$ locates at exact pixel (x, y) to start print string assigned to it = text$
* is an Ascii character width 8 pixels, height 16 pixels
each * takes an 8x16 pixel space to print, That's the 8 and 16 multiplied by i

for x start at xc center pixel of screen and back up half the length of string = .5 * i * 8
for y start i * 16 = row added 20 to offset from top of screen for space before first star.

String$(n, x$) creates string of n * x$ (first char in x$)
b = b + ...
Reply


Messages In This Thread
RE: request for printing patterns with for loops tutorial - by bplus - 11-20-2024, 06:14 AM



Users browsing this thread: 2 Guest(s)