' Challenge of the month August 2012 Graphical Challenge 2 Manta swimming by NaochanON
bubble()
manta()
position()
While "true"
Mantamoving()
bubbling()
Program.Delay(50)
NN=NN+.2*PM
Shapes.SetOpacity(bg,10+NN)
If NN=50 Then
PM=-1
ElseIf NN<10 then
PM=1
EndIf
endwhile
Sub bubbling
For k=1 To 100
by=Math.GetRandomNumber(5)
sby[k]=sby[k]+by/100
Shapes.Move(bbl[k],Shapes.GetLeft(bbl[k]),Shapes.Gettop(bbl[k])-sby[k])
If Shapes.Gettop(bbl[k])<-50 Then
Shapes.Move(bbl[k],Math.GetRandomNumber(1200),Math.GetRandomNumber(900)+600)
sby[k]=0
EndIf
endfor
EndSub
Sub mantamoving
zm= zm+0.01
If 0.5
zm=0
EndIf
For i= 1 To 10
dx= Math.GetRandomNumber(2)
dy= 2-Math.GetRandomNumber(3)
sdx[i]=sdx[i]+dx/100
sdy[i]=sdy[i]+dy/10
For j=1 To 10
Shapes.Move(fig[j][i],Shapes.GetLeft(fig[j][i])-sdx[i],Shapes.Gettop(fig[j][i])+sdy[i])
If j=3 Or j=5 Then
Shapes.Zoom(fig[j][i],1,1-zm )
EndIf
If j=7 Then
Shapes.Rotate(fig[j][i],10-zm*30)
endif
endfor
If Shapes.GetLeft(fig[1][i])<-200 Then
sdx[i]=0
sdy[i]=0
setpositin()
Endif
EndFor
EndSub
Sub manta
for i=1 To 10
GraphicsWindow.BrushColor="Navy"
GraphicsWindow.PenColor ="Navy"
fig[1][i]=Shapes.AddEllipse(18,5)
fig[2][i]=Shapes.AddEllipse(18,5)
color=text.Append("#4040",(30+i*6))
GraphicsWindow.BrushColor=color
GraphicsWindow.PenColor =color
fig[3][i]=Shapes.AddTriangle(36,0,0,50,50,50)
fig[4][i]=Shapes.AddRectangle(50,33)
fig[5][i]=Shapes.AddTriangle(0,0,28,37,50,0)
fig[6][i]=Shapes.AddTriangle(0,0,10,16,0,33)
fig[7][i]=Shapes.AddTriangle(0,0,45,3,0,6)
fig[8][i]=Shapes.AddRectangle(7,10)
fig[9][i]=Shapes.AddRectangle(7,10)
fig[10][i]=Shapes.AddRectangle(5,25)
EndFor
EndSub
Sub position
For i=1 To 10
setpositin()
EndFor
EndSub