Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Best Snowflakes So Far
#1
My best snowflakes so far. I used snow code I had years ago and mashed it together with my new snowflake star. 

Edit: Removed Pi, not needed. Also removed one commented out line. 

Code: (Select All)

'Snowflakes - My best so far!
'By SierraKen
'December 11, 2024

Screen _NewImage(800, 600, 32)

_Title "Snowflakes by SierraKen"

nSnow = 100

Dim y(nSnow), speed(nSnow), x(nSnow), s(nSnow)

Dim xx(nSnow)
Dim yy(nSnow)
Dim oldxx(nSnow)
Dim oldyy(nSnow)
Dim xxx(nSnow)
Dim yyy(nSnow)
Dim oldxxx(nSnow)
Dim oldyyy(nSnow)
Dim tt(nSnow)
Dim dir(nSnow)
Dim size(nSnow)

Randomize Timer

For i = 1 To nSnow
    x(i) = Rnd * 800 + 1
    y(i) = 0
    speed(i) = Rnd * 5 + 1
    s(i) = Rnd * 5
    If s(i) < 1 Then s(i) = 1
    If s(i) > 5 Then s(i) = 1

    xx(i) = Rnd * 800 + 1
    yy(i) = 0
    tt(i) = -360
    dir(i) = 1
    size(i) = Int(Rnd * 20) + 5
Next

L = 200
Do
    _Limit 100
    Paint (2, 2), _RGB32(122, 144, 155)
    For i = 1 To nSnow
        y(i) = y(i) + speed(i)
        For sze = .25 To s(i) Step .25
            Circle (x(i), y(i)), sze, _RGB32(255, 255, 255)
        Next
    Next

    For bb = 1 To nSnow
        If tt(bb) > 0 Then
            tt(bb) = tt(bb) + .2
        End If
        If tt(bb) < 0 Or tt(bb) = 0 Then
            tt(bb) = tt(bb) - .2
        End If
        If tt(bb) > 360 Then
            tt(bb) = 0
        End If
        If tt(bb) < -360 Then
            tt(bb) = 0
        End If
        oldxxx(bb) = xxx(bb)
        oldyyy(bb) = yyy(bb)
        xxx(bb) = Sin(tt(bb))
        yyy(bb) = Cos(tt(bb))

        For t = 0 To 360
            xx(bb) = Sin(t) * size(bb) + x(bb)
            yy(bb) = Cos(t) * size(bb) + y(bb)
            If t = 0 Then
                oldxx(bb) = xx(bb)
                oldyy(bb) = yy(bb)
            End If
            If t / 4 = Int(t / 4) Then
                Line (xx(bb), yy(bb))-(oldxx(bb), oldyy(bb)), _RGB32(255, 255, 255)
                oldxx(bb) = xx(bb)
                oldyy(bb) = yy(bb)
            End If

        Next t
    Next bb

    _Display
    Cls
    For i = 1 To nSnow
        ' is x or y off screen?
        If x(i) > _Width Or x(i) < 0 Then s(i) = Rnd * 5 + 1: y(i) = 0: x(i) = Rnd * 800 + 1: speed(i) = Rnd * 5 + 1
        If y(i) > _Height Or y(i) < 0 Then s(i) = Rnd * 5 + 1: y(i) = 0: x(i) = Rnd * 800 + 1: speed(i) = Rnd * 5 + 1
        If xx(i) > _Width Or xx(i) < 0 Then s(i) = Rnd * 5 + 1: yy(i) = 0: xx(i) = Rnd * 800 + 1: speed(i) = Rnd * 5 + 1
        If yy(i) > _Height Or yy(i) < 0 Then s(i) = Rnd * 5 + 1: yy(i) = 0: xx(i) = Rnd * 800 + 1: speed(i) = Rnd * 5 + 1
        size(i) = Int(Rnd * 10) + 5
        xx(i) = Rnd * 800 + 1
        yy(i) = 0
        tt(i) = -360
        dir(i) = 1
    Next
    a$ = InKey$
    If a$ = Chr$(27) Then End
Loop
Reply


Messages In This Thread
My Best Snowflakes So Far - by SierraKen - 12-12-2024, 06:12 AM
RE: My Best Snowflakes So Far - by Dimster - 12-12-2024, 02:02 PM
RE: My Best Snowflakes So Far - by Petr - 12-12-2024, 03:05 PM
RE: My Best Snowflakes So Far - by SierraKen - 12-12-2024, 05:58 PM
RE: My Best Snowflakes So Far - by SierraKen - 12-12-2024, 06:06 PM
RE: My Best Snowflakes So Far - by SierraKen - 12-12-2024, 06:51 PM
RE: My Best Snowflakes So Far - by SierraKen - 12-12-2024, 09:11 PM
RE: My Best Snowflakes So Far - by grymmjack - 12-15-2024, 12:01 PM
RE: My Best Snowflakes So Far - by SierraKen - 12-15-2024, 04:42 PM



Users browsing this thread: 3 Guest(s)