12-21-2023, 10:25 AM
(12-09-2023, 12:00 PM)johnno56 Wrote: Reminds me of a "Starfield" but with a "Christmas-y" feel... Cool... Nicely done!
Your wish is my command
Here is the source code of the Starfield Simplified ...
note : Actually, it was just a modification of Marcus' Snowflakes. Thanks to Marcus
Code:
'----------------
' INITIALIZATION
'----------------
set window "Starfleet - simplified",800,600,false
set redraw off
stars = []
for i = 0 to 199 stars[i] = [x: rnd()*2-1, y:rnd()*2-1, z:0.1+rnd()*0.9]
wp = 800/2; hp = 600/2 'center of the screen
'-----------------
' MAIN PROGRAM
'-----------------
do
set color 0,0,0;cls 'black
for i = 0 to 199
stars[i].z = stars[i].z - 0.01
if stars[i].z < 0.1
stars[i].z = stars[i].z + 0.9
endif
'Coordinate (x,y) is moving from center
x = wp + stars[i].x*wp/stars[i].z
y = hp + stars[i].y*hp/stars[i].z
radius = 1/stars[i].z
set color 255,255,255 'white
draw ellipse x,y,radius,radius,1 '1=filled
next
fwait 60
redraw
until keydown(KEY_ESCAPE) or mousebutton(0)