Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Vince's Corner Takeout
#36
classic starscape mod

Code: (Select All)
randomize timer
dim shared pi, d, zz, sw, sh
pi = 4*atn(1)
d = 700
zz = 2100
sw = 1280
sh = 720

type stype
    x as double
    y as double
    z as double
end type
dim shared star(2000) as stype

type gtype
    x as double
    y as double
    z as double

    r as double
    r1 as double
    r2 as double

    a1 as double
    a2 as double
    a3 as double
end type
dim shared galaxy(100) as gtype


screen _newimage(sw, sh, 32)

for i=0 to 2000
    star(i).x = 5000*rnd-2500
    star(i).y = 5000*rnd-2500
    star(i).z = 5000*rnd-2500
next
for i=0 to 30
    galaxy(i).x = 4000*rnd-2000
    galaxy(i).y = 4000*rnd-2000
    galaxy(i).z = 4000*rnd-2000
    galaxy(i).r = 150*rnd
    galaxy(i).r1 = rnd
    galaxy(i).r2 = rnd
    galaxy(i).a1 = 2*pi*rnd
    galaxy(i).a2 = 2*pi*rnd
    galaxy(i).a3 = 4*pi*rnd - 2.5*pi*rnd
next

do
    cls

    for i=0 to 2000
        star(i).z = star(i).z - 100
        if star(i).z < 0 then
            star(i).x = 4000*rnd-2000
            star(i).y = 4000*rnd-2000
            star(i).z = 4000*rnd-2000
        end if
        x1 = star(i).x
        y1 = star(i).y
        z1 = star(i).z
        for z0 = 0 to 3
            pset (sw/2 + x1*d/(z1 + zz + z0*10), sh/2 - y1*d/(z1 + zz + z0*10)),_rgb(255 - 50*z0, 255 - 50*z0, 0)
        next
    next

    for i=0 to 30
        galaxy(i).z = galaxy(i).z - 100
        if galaxy(i).z < -zz then
            galaxy(i).x = 4000*rnd-2000
            galaxy(i).y = 4000*rnd-2000
            galaxy(i).z = 8000*rnd'-2000
            galaxy(i).r = 10*rnd + 30
            galaxy(i).r1 = rnd
            galaxy(i).r2 = rnd
            galaxy(i).a1 = 2*pi*rnd
            galaxy(i).a2 = 2*pi*rnd
            galaxy(i).a3 = 4*pi*rnd - 2.5*pi*rnd
        end if
        x1 = galaxy(i).x
        y1 = galaxy(i).y
        z1 = galaxy(i).z
        r = galaxy(i).r
        r1 = galaxy(i).r1
        r2 = galaxy(i).r2
        a1 = galaxy(i).a1
        a2 = galaxy(i).a2
        a3 = galaxy(i).a3
        drawgalaxy x1, y1, z1, r, r1, r2, a1, a2, a3
    next

    _display
    _limit 30
loop until _keyhit = 27
sleep
system

sub drawgalaxy(x1, y1, z1, r, r1, r2, a1, a2, u)
    dim c as _unsigned long

    for a=0 to u step 0.1
        for i=0 to 0.001*r*(u - a)^3.5
            x0 = (rnd - 0.5)*0.2*r*(u - a)
            y0 = (rnd - 0.5)*0.2*r*(u - a)
            z0 = (rnd - 0.5)*0.2*r*(u - a)

            if x0*x0 + y0*y0 + z0*z0 < 2000 then
            for k=0 to 1
                x = x0 + r1*r*a*cos(a + k*pi)
                y = y0 + r2*r*a*sin(a + k*pi)
                z = z0 + 1

                rot x, y, a1
                rot y, z, a2

                c = 255*(u - a)/2
                rr = c + rnd*50
                gg = 0.2*c + rnd*50
                bb = 0
                if rr < 0 then rr = 0
                if gg < 0 then gg = 0
                if bb < 0 then bb = 0
                if rr > 255 then rr = 255
                if gg > 255 then gg = 255
                if bb > 255 then bb = 255
                rr = rr - z1/100
                gg = gg - z1/100
                bb = bb - z1/100

                pset (sw/2 + (x + x1)*d/(z + z1 + zz), sh/2 - (y + y1)*d/(z + z1 + zz)), _rgb(rr, gg, bb)
            next
            end if
        next
    next
end sub

sub rot(xx, yy, a)
    x = xx
    y = yy
    xx = x*cos(a) - y*sin(a)
    yy = x*sin(a) + y*cos(a)
end sub
Reply


Messages In This Thread
Vince's Corner Takeout - by bplus - 04-29-2022, 02:12 PM
RE: Vince's Corner Takeout - by vince - 04-29-2022, 09:34 PM
RE: Vince's Corner Takeout - by vince - 05-02-2022, 03:10 AM
RE: Vince's Corner Takeout - by bplus - 05-02-2022, 04:25 AM
RE: Vince's Corner Takeout - by vince - 05-02-2022, 11:16 PM
RE: Vince's Corner Takeout - by vince - 05-03-2022, 01:10 AM
RE: Vince's Corner Takeout - by bplus - 05-03-2022, 01:15 AM
RE: Vince's Corner Takeout - by vince - 05-03-2022, 04:26 AM
RE: Vince's Corner Takeout - by bplus - 05-03-2022, 03:32 PM
RE: Vince's Corner Takeout - by vince - 05-10-2022, 03:41 AM
RE: Vince's Corner Takeout - by vince - 05-10-2022, 03:57 AM
RE: Vince's Corner Takeout - by dcromley - 05-10-2022, 02:57 PM
RE: Vince's Corner Takeout - by vince - 05-10-2022, 08:14 PM
RE: Vince's Corner Takeout - by SMcNeill - 05-10-2022, 02:59 PM
RE: Vince's Corner Takeout - by vince - 05-11-2022, 01:13 AM
RE: Vince's Corner Takeout - by dcromley - 05-11-2022, 01:58 AM
RE: Vince's Corner Takeout - by vince - 06-01-2022, 09:05 AM
RE: Vince's Corner Takeout - by vince - 08-11-2022, 02:51 AM
RE: Vince's Corner Takeout - by bplus - 06-03-2022, 02:47 PM
RE: Vince's Corner Takeout - by triggered - 06-04-2022, 02:00 AM
RE: Vince's Corner Takeout - by vince - 06-07-2022, 02:02 AM
RE: Vince's Corner Takeout - by bplus - 06-07-2022, 02:15 AM
RE: Vince's Corner Takeout - by vince - 07-13-2022, 05:23 AM
RE: Vince's Corner Takeout - by BSpinoza - 07-14-2022, 04:54 AM
RE: Vince's Corner Takeout - by bplus - 07-14-2022, 04:35 PM
RE: Vince's Corner Takeout - by aurel - 08-11-2022, 01:02 PM
RE: Vince's Corner Takeout - by bplus - 08-11-2022, 04:22 PM
RE: Vince's Corner Takeout - by aurel - 08-11-2022, 05:33 PM
RE: Vince's Corner Takeout - by BSpinoza - 08-12-2022, 03:44 AM
RE: Vince's Corner Takeout - by vince - 08-11-2022, 08:42 PM
RE: Vince's Corner Takeout - by vince - 08-19-2022, 05:00 AM
RE: Vince's Corner Takeout - by bplus - 08-19-2022, 06:33 PM
RE: Vince's Corner Takeout - by vince - 08-23-2022, 10:04 PM
RE: Vince's Corner Takeout - by vince - 11-04-2022, 01:48 AM
RE: Vince's Corner Takeout - by vince - 03-31-2023, 11:07 PM
RE: Vince's Corner Takeout - by vince - 09-18-2023, 11:45 PM
RE: Vince's Corner Takeout - by Dav - 09-19-2023, 12:54 AM
RE: Vince's Corner Takeout - by bplus - 09-19-2023, 01:37 AM
RE: Vince's Corner Takeout - by GareBear - 09-19-2023, 03:56 PM
RE: Vince's Corner Takeout - by bplus - 09-19-2023, 04:47 PM
RE: Vince's Corner Takeout - by vince - 09-19-2023, 06:54 PM
RE: Vince's Corner Takeout - by bplus - 09-19-2023, 09:02 PM
RE: Vince's Corner Takeout - by vince - 01-13-2024, 07:15 PM
RE: Vince's Corner Takeout - by bplus - 01-13-2024, 07:59 PM
RE: Vince's Corner Takeout - by GareBear - 01-13-2024, 10:54 PM
RE: Vince's Corner Takeout - by vince - 02-16-2024, 04:01 AM
RE: Vince's Corner Takeout - by bplus - 02-16-2024, 02:27 PM
RE: Vince's Corner Takeout - by vince - 02-16-2024, 07:16 PM
RE: Vince's Corner Takeout - by Sprezzo - 02-17-2024, 03:04 AM
RE: Vince's Corner Takeout - by bplus - 02-17-2024, 02:44 PM
RE: Vince's Corner Takeout - by vince - 10-07-2024, 08:11 AM
RE: Vince's Corner Takeout - by bplus - 10-07-2024, 01:32 PM
RE: Vince's Corner Takeout - by vince - 10-11-2024, 12:05 AM
RE: Vince's Corner Takeout - by vince - 10-11-2024, 12:16 AM
RE: Vince's Corner Takeout - by PhilOfPerth - 10-11-2024, 03:51 AM
RE: Vince's Corner Takeout - by vince - 10-11-2024, 07:55 PM
RE: Vince's Corner Takeout - by PhilOfPerth - 10-11-2024, 11:30 PM
RE: Vince's Corner Takeout - by vince - 10-15-2024, 10:54 AM
RE: Vince's Corner Takeout - by bplus - 10-15-2024, 01:40 PM



Users browsing this thread: 18 Guest(s)