Some demos.
Code: Select all
Include "library.cb"
SCREEN 640,480,32,1
font = LoadFont("courier",24)
SetFont font
FrameLimit 90
Global col,anzahl,xscreen,yscreen,ymitte,xmitte,i,aSpeed#
anzahl=1000
xscreen=640
yscreen=480
xmitte = xscreen/2
ymitte = yscreen/2
Dim x#(1000)
Dim y#(1000)
Dim angle#(1000)
Dim speed#(1000)
Dim sinus#(360)
Dim cosinus#(360)
For i=1 To anzahl
x(i) = xmitte
y(i) = ymitte
angle(i)= Rand(1,360)
speed(i)= Rand(1,3)
Next i
For i=0 To 360
sinus(i) = Sin(i)
cosinus(i)= Cos(i)
Next i
Function xMove(x1#,w#,sp#)
Return x1 + Cosinus(int(w))*sp
End Function
Function yMove(y1#,w#,sp#)
Return y1 + Sinus(int(w))*sp
End Function
PlaySound "cosmobumm.wav"
While EscapeKey()=0
ClearScreen(2,2,2)
For i=0 To anzahl
aSpeed = Distance(xmitte, ymitte, x(i), y(i)) /200 * speed(i)+1
x(i) = xMove(x(i), angle(i), aSpeed)
y(i) = yMove(y(i), angle(i), aSpeed)
if x(i) < 0 Or x(i) > xscreen Or y(i) < 0 Or y(i) > yscreen Then
x(i) = xmitte
y(i) = ymitte
angle(i)= Rand(1,360)
speed(i) = Rand(1,3)
End If
col= Int(speed(i)*100 - 55)
Oval(Int(x(i)),Int(y(i)),6,6,col,col,col)
Next i
xmitte = MouseX()
ymitte = MouseY()
DrawScreen OFF
Wend