a2
 
 
  1. 1.      Community Suggestion 2 (By Nonki)
  2. http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/7239821c-161c-4328-b29d-7c55e40b11b9
  3. 3.      Draw a picture of  cars  (Moving)   TJV532 

 ´ Challenge of the month April 2013 Moving Cars by NaochanON
shapecars()
shapes_Add()
While ”true”
L_Cars_Moving()
R_Cars_Moving()
Program.Delay(50)
endwhile
Sub L_Cars_Moving
For L=1 To 5
For i=1 To 9
Shapes.Move(SHP[L][i]["obj"],Shapes.GetLeft(SHP[L][i]["obj"])-Vx[L],Shapes.GetTop(SHP[L][i]["obj"]))
EndFor
If Shapes.GetLeft(SHP[L][1]["obj"])<-200 Then
DDX=Math.GetRandomNumber(400)
For i=1 To 9
Shapes.Move(SHP[L][i]["obj"],Shapes.GetLeft(SHP[L][i]["obj"])+1300+DDX,Shapes.GetTop(SHP[L][i]["obj"]))
EndFor
EndIf
EndFor
EndSub
Sub R_Cars_Moving
For L=6 To 10
For i=1 To 9
Shapes.Move(SHP[L][i]["obj"],Shapes.GetLeft(SHP[L][i]["obj"])+Vx[L],Shapes.GetTop(SHP[L][i]["obj"]))
EndFor
If Shapes.GetLeft(SHP[L][1]["obj"])>1300 Then
DDX=Math.GetRandomNumber(400)
For i=1 To 9
Shapes.Move(SHP[L][i]["obj"],Shapes.GetLeft(SHP[L][i]["obj"])-1400-DDX,Shapes.GetTop(SHP[L][i]["obj"]))
EndFor
EndIf
EndFor
EndSub
Sub shapecars
GraphicsWindow.BackgroundColor=”Darkgreen”
GraphicsWindow.Width=1200
GraphicsWindow.Height=700
GraphicsWindow.Top=0
GraphicsWindow.Left=20
GraphicsWindow.Hide()
X0 = 0  ‘ x offset
Y0 = 0  ‘ y offset
‘————————————– Left oriented cars ——————————————————————————–
s=0.55
start=1
End=9
For L=1 To 5
shp[L][1] = ”func=rect;x=4;y=23;width=130;height=25;bc=#00F0CA;pc=#000000;pw=2;”
shp[L][2] = ”func=ell;x=20;y=33;width=23;height=23;bc=#9D756A;pc=#000000;pw=2;”
shp[L][3] = ”func=ell;x=95;y=32;width=23;height=23;bc=#9D756A;pc=#000000;pw=2;”
shp[L][4] = ”func=rect;x=48;y=2;width=54;height=23;bc=#E0F0CA;pc=#000000;pw=2;”
shp[L][5] = ”func=tri;x=41;y=5;x1=7;y1=0;x2=0;y2=17;x3=15;y3=17;bc=#E0F0CA;pc=#E0F0CA;pw=2;”
shp[L][6] = ”func=tri;x=91;y=5;x1=9;y1=0;x2=0;y2=17;x3=18;y3=17;bc=#E0F0CA;pc=#E0F0CA;pw=2;”
shp[L][7] = ”func=ell;x=0;y=26;width=11;height=12;bc=#FFFF00;pc=#FF0000;pw=2;”
shp[L][8] = ”func=ell;x=58;y=5;width=10;height=15;bc=#6A5ACD;pc=#6A5ACD;pw=4;”
shp[L][9] = ”func=rect;x=56;y=20;width=15;height=10;bc=#FF5ACD;pc=#6A5ACD;pw=4;”
Shapes_Add()
DX=Math.GetRandomNumber(L+2)*130
Y_Pos()
For i=start To end
shapes.Move(SHP[L][i]["obj"],Shapes.GetLeft(SHP[L][i]["obj"])+100+DX,Shapes.GetTop(SHP[L][i]["obj"])+DY-30)
EndFor
Vx[L]=2.5+Math.GetRandomNumber(20)/10
EndFor
‘————————————– Right oriented cars ——————————————————————————–
For L=6 To 10
shp[L][1] = ”func=rect;x=6;y=83;width=130;height=25;bc=#E000CA;pc=#000000;pw=2;”
shp[L][2] = ”func=ell;x=20;y=93;width=23;height=23;bc=#9D756A;pc=#000000;pw=2;”
shp[L][3] = ”func=ell;x=95;y=92;width=23;height=23;bc=#9D756A;pc=#000000;pw=2;”
shp[L][4] = ”func=rect;x=48;y=62;width=54;height=23;bc=#E0F0CA;pc=#000000;pw=2;”
shp[L][5] = ”func=tri;x=41;y=65;x1=7;y1=0;x2=0;y2=17;x3=15;y3=17;bc=#E0F0CA;pc=#E0F0CA;pw=2;”
shp[L][6] = ”func=tri;x=91;y=65;x1=9;y1=0;x2=0;y2=17;x3=18;y3=17;bc=#E0F0CA;pc=#E0F0CA;pw=2;”
shp[L][7] = ”func=ell;x=128;y=86;width=11;height=12;bc=#FFFF00;pc=#FF0000;pw=2;”
shp[L][8] = ”func=ell;x=85;y=61;width=10;height=15;bc=#6A5ACD;pc=#6A5ACD;pw=4;”
shp[L][9] = ”func=rect;x=82;y=76;width=15;height=10;bc=#FF5ACD;pc=#6A5ACD;pw=4;”
Shapes_Add()
DX=Math.GetRandomNumber(L-3)*130
Y_Pos()
For i=start To end
shapes.Move(SHP[L][i]["obj"],Shapes.GetLeft(SHP[L][i]["obj"])+500-DX,Shapes.GetTop(SHP[L][i]["obj"])+DY-30)
EndFor
Vx[L]=2.5+Math.GetRandomNumber(20)/10
EndFor
‘ ‘———————————————————————————————————————-
GraphicsWindow.Show()
EndSub
Sub shapes_Add
For i = start To End
GraphicsWindow.PenWidth = SHP[L][i]["pw"]*s
GraphicsWindow.PenColor = SHP[L][i]["pc"]
GraphicsWindow.BrushColor = SHP[L][i]["bc"]
If SHP[L][i]["func"] = ”rect” Then
SHP[L][i]["obj"] = Shapes.AddRectangle(SHP[L][i]["width"]*s, SHP[L][i]["height"]*s)
ElseIf SHP[L][i]["func"] = ”ell” Then
SHP[L][i]["obj"] = Shapes.AddEllipse(SHP[L][i]["width"]*s, SHP[L][i]["height"]*s)
ElseIf SHP[L][i]["func"] = ”tri” Then
SHP[L][i]["obj"] = Shapes.AddTriangle(SHP[L][i]["x1"]*s, SHP[L][i]["y1"]*s, SHP[L][i]["x2"]*s, SHP[L][i]["y2"]*s, SHP[L][i]["x3"]*s, SHP[L][i]["y3"]*s)
ElseIf SHP[L][i]["func"] = ”line” Then
SHP[L][i]["obj"] = Shapes.AddLine(SHP[L][i]["x1"]*s, SHP[L][i]["y1"]*s, SHP[L][i]["x2"]*s, SHP[L][i]["y2"]*s)
EndIf
Shapes.Move(SHP[L][i]["obj"], X0 + SHP[L][i]["x"]*s, Y0 + SHP[L][i]["y"]*s)
Shapes.Rotate(SHP[L][i]["obj"], SHP[L][i]["angle"])
EndFor
endsub
Sub Y_Pos
Again:
DY=(Math.GetRandomNumber(12)-1)*60
If Text.IsSubText(SDY,DY) Then
Goto Again
EndIf
SDY=SDY+DY+”;”
endsub