这是完整的代码:
GraphicsWindow.Clear()
GraphicsWindow.CanResize = "false"
GraphicsWindow.Height = Desktop.Height-200
GraphicsWindow.Width = Desktop.Width-200
scount = Math.GetRandomNumber(25)
For s = 1 To scount
Shx[s] = Math.GetRandomNumber(GraphicsWindow.Width-100)
Shy[s] = Math.GetRandomNumber(GraphicsWindow.Height-100)
shsize[s] = Math.GetRandomNumber(50)
Sh[s] = Shapes.AddEllipse(shsize[s],shsize[s])
Shapes.Move(Sh[s],Shx[s],Shy[s])
EndFor
loop:
For s = 1 to scount
op[s] = Math.GetRandomNumber(2)
If op[s] = 1 Then
vel[s] = .5
EndIf
If op[s] = 2 Then
vel[s] = -.5
EndIf
Shx[s] = Shx[s] + vel[s]
Shy[s] = Shy[s] + vel[s]
Shapes.Move(Sh[s],Shx[s],Shy[s])
EndFor
Goto loop
我的猜测是问题出在这里:
op[s] = Math.GetRandomNumber(2)
If op[s] = 1 Then
vel[s] = .5
EndIf
If op[s] = 2 Then
vel[s] = -.5
EndIf
我需要做什么才能使形状在独立的方向上移动而不会抖动?