Microsoft Small Basic

Program Listing: KRH756
GraphicsWindow.Width = 1280
GraphicsWindow.Height = 800
GraphicsWindow.BackgroundColor = "Cyan"
GraphicsWindow.DrawEllipse(0,0,640,800)
GraphicsWindow.DrawEllipse(640,0,640,800)
GraphicsWindow.FillEllipse(355,400,10,10)
GraphicsWindow.FillEllipse(902,400,10,10)
GraphicsWindow.CanResize = "False"
For i = 1 To 5
Ball1[i] = Shapes.AddEllipse(10,10)
Ball2[i] = Shapes.AddEllipse(10,10)
Dx[i] = i/5
Dy[i] = Dx[i]
Ball1y[i] = 400
Ball1X[i] = 400
DistPart[i] = 510-Dx[i]*45
EndFor
While 1 = 1
Program.Delay(5)
For i = 1 To 5
Ball1X[i] = Ball1X[i] + Dx[i]
Ball1y[i] = Ball1y[i] + Dy[i]
Shapes.Move(Ball2[i],Ball1X[i]+DistPart[i],Ball1y[i])
Shapes.Move(Ball1[i],Ball1X[i],Ball1y[i])

If Ball1X[i] <= 200 Then
Dx[i] = - Dx[i]
EndIf
If Ball1X[i] > 540-10 Then
Dx[i] = - Dx[i]
EndIf
If Ball1y[i] <= 200 Then
Dy[i] = - Dy[i]
EndIf
If Ball1y[i] > 600 Then
Dy[i] = - Dy[i]
EndIf
EndFor
EndWhile