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.
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