Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
request for printing patterns with for loops tutorial
#4
Color the tree:
Code: (Select All)
Screen _NewImage(400, 600, 32)
xc = 200
For i = 1 To 31
    Locate i + 1, 25 - Int(i / 2)
    For j = 1 To i
        Color _RGB32(Rnd * 200 + 55, -(Rnd < .5) * Rnd * 255, -(Rnd < .5) * Rnd * 255)
        Print "*";
    Next
Next
Color _RGB32(100, 50, 25)
For i = 32 To 35
    _PrintString (xc - .5 * 2 * 8, i * 16), String$(2, "*")
Next
Sleep

Color the tree AND make lights twinkle:
Code: (Select All)
Screen _NewImage(400, 600, 32)
_PrintMode _KeepBackground
xc = 200
For i = 1 To 31
    Locate i + 1, 25 - Int(i / 2)
    For j = 1 To i
        Color _RGB32(Rnd * 200 + 55, -(Rnd < .5) * Rnd * 255, -(Rnd < .5) * Rnd * 255)
        Print "*";
    Next
Next
Color _RGB32(100, 50, 25)
For i = 32 To 35
    _PrintString (xc - .5 * 2 * 8, i * 16), String$(2, "*")
Next
' twinkle
Do
    i = Int(Rnd * 31) + 1
    Locate i + 1, 25 - Int(i / 2)
    k = Int(Rnd * i) + 1
    For j = 1 To i
        If j = k Then
            Color _RGB32(Rnd * 200 + 55, -(Rnd < .5) * Rnd * 255, -(Rnd < .5) * Rnd * 255)
            Print "*";
        Else
            Print " ";
        End If
    Next
    _Limit 10
Loop
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  _Clearcolor and _setalpha day request TempodiBasic 0 445 04-29-2025, 09:27 AM
Last Post: TempodiBasic
  a little tutorial demo for Windows in SCREEN 0 TempodiBasic 0 586 12-10-2024, 01:00 AM
Last Post: TempodiBasic
  Portable Version of Terry Ritchie's Tutorial Updated mpgcan 6 5,819 09-22-2024, 09:13 PM
Last Post: TerryRitchie
  Steve's basic SIN/COS Tutorial SMcNeill 5 1,809 07-12-2024, 06:53 PM
Last Post: vince
  BIG QB64 Tutorial update TerryRitchie 4 1,518 05-22-2024, 06:20 PM
Last Post: TerryRitchie

Forum Jump:


Users browsing this thread: 1 Guest(s)