include "window.inc"

Window " ~_~ ", 640, 480, 2
Font 12,24,0,"courier"

sys color, anz=5000, speed=2, xScreen=640,yScreen=480
dim stern_x(5000) as int
dim stern_y(5000) as int
dim stern_z(5000) as int

Sub StarInit()
int i
for i=0 to anz
   stern_x(i) = Rand( -(xscreen\2), (xscreen\2)) << 8
   stern_y(i) = Rand( -(yscreen\2), (yscreen\2)) << 8
   stern_z(i) = Rand(speed,255)
next 
End Sub

Function StarUpdate()
int i,s_x,s_y,color
for i=0 to anz
   stern_z(i) = stern_z(i) - speed
   if stern_z(i) <= speed then stern_z(i) = 255
   s_x = (stern_x(i) / stern_z(i)) + (xscreen / 2)
   s_y = (stern_y(i) / stern_z(i)) + (yscreen / 2)
   color =255 - stern_z(i)
   color += color | (color << 8) | (color << 16)
   GetRGB color
   Oval s_x, s_y, 4,4, cRGB.r,cRGB.g,cRGB.b 
next
End Function

StarInit
While AscKey=0 and WinExit=0
ClsColor 0,0,0
StarUpdate
Events
FlipBuffer
WaitFPS 60
Wend
WinEnd