Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Snowflakes
#3
(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  Big Grin Big Grin Big Grin
Here is the source code of the Starfield Simplified ...
note : Actually, it was just a modification of Marcus' Snowflakes. Thanks to Marcus  Big Grin

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)
Reply


Messages In This Thread
Snowflakes - by Marcus - 12-09-2023, 11:15 AM
RE: Snowflakes - by johnno56 - 12-09-2023, 12:00 PM
RE: Snowflakes - by 1micha.elok - 12-21-2023, 10:25 AM
RE: Snowflakes - by johnno56 - 12-21-2023, 06:15 PM
RE: Snowflakes - by Marcus - 12-22-2023, 12:43 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)