Hello,
include "ogl.inc"
Window 800, 600, 1
sys anzahl=1000,xscreen=800,yscreen=600
sys xmitte= 400,ymitte =300
single aSpeed,v
bmpload 1,"bmp/coin_strip.bmp"
dim phase(1000) as sys
dim x(1000) as single
dim y(1000) as single
dim winkl(1000) as single
dim speed(1000) as single
dim sinus(360) as single
dim cosin(360) as single
for i=0 to anzahl-1
x(i) = xmitte
y(i) = ymitte
winkl(i)= rand(1,360)
speed(i)= rand(1,3)
next
for i=0 to 999
phase(i) = rand(0,7)
next
for i=0 to 360
sinus(i)= sin(rad(i))
cosin(i)= cos(rad(i))
next
Function xMove(single x,w,speed) as single
return x + Cosin(w)*speed
End Function
Function yMove(single y,w,speed) as single
return y + Sinus(w)*speed
End Function
Function Distance(single x1,y1,x2,y2) as single
sys dx, dy
dx = x1-x2: dy = y1-y2
return abs(sqr(dx*dx+dy*dy))
End Function
while Key(27)=0
cls 255,255,255
for i=0 to anzahl-1
aSpeed = Distance (xmitte, ymitte, x(i), y(i)) /200 * speed(i)+1
x(i) = xMove(x(i), winkl(i), aSpeed)
y(i) = yMove(y(i), winkl(i), aSpeed)
if x(i) < -32 Or x(i) > xscreen Or y(i) < -32 Or y(i) > yscreen
x(i) = xmitte
y(i) = ymitte
winkl(i) = rand(1,360)
speed(i) = rand(1,3)
end if
SpriteAnimate 1,x(i),y(i),32,32,phase(i)
next
v +=.2
if v >=1 then
v = 0
for i=1 to 1000
phase[i] +=1
if phase[i]=6 then phase[i]=0
next
end if
xmitte = xMouse
ymitte = yMouse
redraw
wait 10
Wend
winEnd
.