12-10-2024, 01:48 AM
I finally made some snowflakes without any help or anyone else's code.
The dancing effect came just by experimentation.
The dancing effect came just by experimentation.
Code: (Select All)
'Dancing Snowflakes By SierraKen
Screen _NewImage(800, 600, 32)
Dim x(100)
Dim y(100)
Dim xx(100)
Dim yy(100)
Dim oldxx(100)
Dim oldyy(100)
Dim xxx(100)
Dim yyy(100)
Dim oldxxx(100)
Dim oldyyy(100)
Dim a(100)
Dim tt(100)
Dim dir(100)
Dim size(100)
size = 25
pi = _Pi
tt = -360
dir = 1
a = -20
Randomize Timer
Do
_Limit 10
GoSub snowflakes:
For bb = 1 To 50
If a(bb) > 600 Then GoSub snowflakes2:
If a(bb) < 1 Then dir(bb) = 1
If dir(bb) = 1 Then a(bb) = a(bb) + (Rnd * 10)
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 + xxx(bb)) * size(bb) + x(bb)
yy(bb) = Cos(t + yyy(bb)) * 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) + xxx(bb), yy(bb) + yyy(bb) + a(bb))-(oldxx(bb) + oldxxx(bb), oldyy(bb) + oldyyy(bb) + a(bb)), _RGB32(255, 255, 255)
oldxx(bb) = xx(bb)
oldyy(bb) = yy(bb)
End If
Next t
Next bb
_Display
Line (0, 0)-(800, 600), _RGB32(0, 0, 200), BF
Loop Until InKey$ = Chr$(27)
End
snowflakes:
For b = 1 To 50
size(b) = Int(Rnd * 35) + 5
x(b) = Int(Rnd * 800) + 1
y(b) = Int(Rnd * 600) - size(b)
If a(b) > 600 Then GoSub snowflakes2:
'If a(b) < 1 Then dir(b) = 1
'If dir(b) = 1 Then a(b) = a(b) + 5
If tt(b) > 0 Then
tt(b) = tt(b) + .2
End If
If tt(b) < 0 Or tt(b) = 0 Then
tt(b) = tt(b) - .2
End If
If tt(b) > 360 Then
tt(b) = 0
End If
If tt(b) < -360 Then
tt(b) = 0
End If
oldxxx(b) = xxx(b)
oldyyy(b) = yyy(b)
xxx(b) = Sin(tt(b))
yyy(b) = Cos(tt(b))
For t = 0 To 360
xx(b) = Sin(t + xxx(b)) * size(b) + x(b)
yy(b) = Cos(t + yyy(b)) * size(b) + y(b)
If t = 0 Then
oldxx(b) = xx(b)
oldyy(b) = yy(b)
End If
If t / 4 = Int(t / 4) Then
Line (xx(b) + xxx(b), yy(b) + yyy(b) + a(b))-(oldxx(b) + oldxxx(b), oldyy(b) + oldyyy(b) + a(b)), _RGB32(255, 255, 255)
oldxx(b) = xx(b)
oldyy(b) = yy(b)
End If
Next t
Next b
_Display
Line (0, 0)-(800, 600), _RGB32(0, 0, 200), BF
Return
snowflakes2:
size(b) = Int(Rnd * 35) + 5
x(b) = Int(Rnd * 800) + 1
y(b) = 0
a(bb) = 0
a(b) = 0
Return