include "window.inc"
Window "^_^",800,600,1
Font 18,28,700,""

Type Star
   float  xStar 
   float  yStar 
   float  speed 
End Type

Dim Stars(250) As Star
sys xRes =800
sys yRes =600 

Macro Rebirth
   Stars(i).yStar = Rand(1, yRes -2)
   Stars(i).speed = Rand(1, 20) *.1+1
End Macro


Function InitStars()
sys i
For i = 1 To 250
  rebirth
  Stars(i).xStar = Rand(1, xRes -2)
Next 
End Function

Function MoveStars()
sys i
For i = 1 To 250 
   Oval Stars(i).xStar,Stars(i).yStar,8,6, Rand(64,128),128,128
   Stars(i).xStar = Stars(i).xStar + Stars(i).speed
   iF Stars(i).xStar > xRes 
   Rebirth
   Stars(i).xStar=0
   End iF
Next
End Function

InitStars()

While AscKey=0 and WinExit=0
ClsColor 0,0,0
MoveStars
Text 320,16,"STARS",0,255,0
Events
FlipBuffer
Wend
WinEnd