Author Topic: 3D Starfield  (Read 18 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 313
  • Karma: 25
  • Hard players don't go home.
    • View Profile
3D Starfield
« on: Yesterday at 12:07 PM »
Done to death, but this is my first.

I finally figuured something out.

Code: [Select]
star=200
dim r(star)
dim x(star)
dim y(star)
dim l(star)
dim d(star)
dim s(star)
dim m(star)

for a=1 to star
r(a)=int(ran(360))*(pi/180)
l(a)=int(ran(400))+160
d(a)=ran(1)-int(ran(2)) rem height
s(a)=ran(2)+2 rem couples with l(a) s(a)/l(a)
m(a)=.005
next a

x=320
y=256

open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window

for a=1 to star
x(a)=cos(r(a))/(sin(r(a))+s(a))*l(a)+x
y(a)=d(a)/(sin(r(a))+s(a))*l(a)+y
next a

for a=1 to star
r(a)=r(a)+m(a)
if m(a)>360 m(a)=0
next a

for a=1 to star
dot x(a),y(a)
next a

until (1=0)
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.