Post by PeterMaria on Jun 27, 2015 15:04:07 GMT -5
Hello,
many coins like SternenTaler.
many coins like SternenTaler.
TextMode(TEXT_BUFFERED)
ResizeSpriteArea(800,600)
dim a1(5) = LoadImageStrip("png/coins.png",32)
Sub SprSetAnimate(nr(),x0,y0,w0,h0,frame)
NewSprite(nr)
SprSetxCentre(0)
SprSetyCentre(0)
SprSetZOrder (1)
SprSetSize (w0,h0)
SprSetPos (x0,y0)
SprSetFrame (frame)
End Sub
Function Rand(min,max)
Return rnd()% (max-min+1)+min
End Function
dim aSpeed#,v#,anzahl,xscreen,yscreen,xmitte,ymitte,i,r#
dim phase(500)
dim x#(500)
dim y#(500)
dim winkl#(500)
dim speed#(500)
dim sinus#(360)
dim cosin#(360)
anzahl=500:xscreen=800:yscreen=600
xmitte=400:ymitte =300
for i=0 to anzahl-1
x#(i) = xmitte
y#(i) = ymitte
winkl#(i)= rand(1,360)
speed#(i)= rand(1,2)
next
for i=0 to anzahl-1
phase(i) = rand(0,5)
next
for i=0 to 360
sinus#(i) = sin(i)
cosin#(i) = cos(i)
next
Function xMove(x#,w#,speed#)
return x# + cosin#(w#)*speed#
End Function
Function yMove(y#,w#,speed#)
return y# + sinus#(w#)*speed#
End Function
Function Distance(x1#,y1#,x2#,y2#)
dim dx, dy
dx = x1#-x2#: dy = y1#-y2#
return abs(sqr(dx*dx+dy*dy))
End Function
while ScanKeyDown(27)=0
for i=0 to anzahl-1
aSpeed# = Distance(xmitte,ymitte, x#(i), y#(i))/100 + speed#(i)
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 then
x#(i) = xmitte
y#(i) = ymitte
winkl#(i) = rand(1,360)
speed#(i) = rand(1,3)
end if
SprSetAnimate(a1,x#(i),y#(i),32,32,phase(i))
next
v# = v#+.5
if v# >=1 then
v#=0
for i=0 to anzahl-1
phase(i) = phase(i)+1
if phase(i)=6 then phase(i)=0: end if
next
end if
xmitte = Mouse_x()*800-16
ymitte = Mouse_y()*600-16
drawtext()
waittimer(20)
ClearSprites()
Wend