yea looks pretty good, only so many ways one can do a starfield, and mine is similar, if you want some more fun I added a little chunk out of my demo code I have been using for years that smoothly cycles though all the RGB color possibilities at a given brightness
openwindow(800,600,0,"Stars") --set to screensaver size
--togglefullscreen()
setframetimer(60) --why are you using this?
angle = 0 -- needed for rainbow color --obo
channel = 0 -- needed for rainbow color --obo
RAD = (math.pi / 180) -- needed for rainbow color -- obo
function rand(minZahl,maxZahl)
maxZahl = (maxZahl-minZahl)
return int(rnd()*maxZahl+minZahl)
end
local sx=0;sy=0;anz=255;speed=0.1;xscreen=screenwidth();yscreen=screenheight() --why are they all local?
local xstern ={}
local ystern ={}
local zstern ={}
for i=0,anz do
xstern[i] = rand(-(xscreen/2), (xscreen/2))*128
ystern[i] = rand(-(yscreen/2), (yscreen/2))*128
zstern[i] = rand(speed,255)
end
-- RAINBOW COLOR -- OBO
getColour = function(angle, channel)
local cos = math.cos(angle * RAD) * 255 -- lower 255 for darker colors
local sin = math.sin(angle * RAD) * 255 -- lower 255 for darker colors
if channel == 0 then colour(cos, sin, 0)
elseif channel == 1 then colour(0, cos, sin)
elseif channel == 2 then colour(sin, 0, cos)
end
end
function updatestars()
local i,x
for i=0,anz do
zstern[i] = zstern[i] - speed
if zstern[i] <= speed then
xstern[i] = rand(-(xscreen/2), (xscreen/2))*128
ystern[i] = rand(-(yscreen/2), (yscreen/2))*128
zstern[i] = 255
end
sx = (xstern[i] / zstern[i]) + (xscreen/2)
sy = (ystern[i] / zstern[i]) + (yscreen/2)
local Rsize = int(255 - zstern[i]) / 100
fillbox(sx-Rsize,sy-Rsize,sx+Rsize,sy+Rsize)
end
end
repeat
k=getkey()
cls()
-- color update --obo
if angle == 90 then
angle = 0
if channel ~= 2 then channel = channel + 1
else channel = 0
end
end
getColour(angle, channel)
angle = angle + 1
-- end color update -- obo
for j = 1,50 do
updatestars()
end
redraw()
until k==27
closewindow()