QB64 Phoenix Edition
Bouncing Kaleidoscope - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7)
+---- Thread: Bouncing Kaleidoscope (/showthread.php?tid=437)



Bouncing Kaleidoscope - SierraKen - 05-19-2022

[Image: Bouncing-Kaleidoscope-by-Sierra-Ken.png]

This is like my other Kaleidoscope but it is much smaller and bounces off the walls. Smile I decided to make it a different thread since they are really completely different. I'll post a picture below. 

Code: (Select All)
'Bouncing Kaleidoscope by SierraKen
'May 18, 2022
Screen _NewImage(800, 800, 32)
_Title "Bouncing Kaleidoscope by SierraKen"
Randomize Timer
cc = 1
dirx = 1
diry = 1
cenx = 400
ceny = 400
Do
    Do
        _Limit 100
        If c <> 0 Then cc = c
        c = Rnd * 100
        If c < cc Then
            s = -.25
        Else
            s = .25
        End If
        cl1 = Int(Rnd * 200) + 1
        cl2 = Int(Rnd * 200) + 1
        cl3 = Int(Rnd * 200) + 1
        cenx = cenx + dirx
        ceny = ceny + diry
        If cenx > 700 Then dirx = -1 * Rnd * 3
        If cenx < 100 Then dirx = 1 * Rnd * 3
        If ceny > 700 Then diry = -1 * Rnd * 3
        If ceny < 100 Then diry = 1 * Rnd * 3
        For t = cc To c Step s
            x = (Sin(t) * t) + cenx
            y = (Cos(t) * t) + ceny
            Circle (x, y), 2, _RGB32(cl1, cl2, cl3)
        Next t
        lp = lp + 1
    Loop Until lp > 20
    lp = 0
    _Display
    Line (0, 0)-(800, 800), _RGB32(0, 0, 0, 10), BF
Loop Until InKey$ = Chr$(27)