Author Topic: Polygon Strings  (Read 1301 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 312
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Polygon Strings
« on: October 17, 2021 »
Use D-pad to individually choose and change the
state of each string star.

Play with random.

Resetable to original start-up.

Code: [Select]
doilys=5
dim a(doilys)
dim r(doilys)
dim points(doilys)
dim span(doilys)
dim jump(doilys)
dim C(doilys)
dim dir(doilys)
dim m(doilys)

for a=1 to doilys
r(a)=a*30+70
points(a)=a*5+15
span(a)=5
C(a)=a
m(1)=1
m(2)=-1
m(3)=1
m(4)=-1
m(5)=1
next a

ang=pi/180
x=256
y=256

restore headings
read heading
dim t$(heading)
for a=1 to heading
read t$(a)
next a

restore cols
read col
dim R(col)
dim G(col)
dim B(col)
dim C$(col)

for a=1 to col
read R(a)
read G(a)
read B(a)
read C$(a)
next a

restore colh
read coh
dim R1(coh)
dim G1(coh)
dim B1(coh)
dim D$(coh)

for a=1 to coh
read R1(a)
read G1(a)
read B1(a)
read D$(a)
next a

dim go(16)
dim g(16)

sel=6

open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")

for a=1 to 16
if and(c,2^(a-1))<>0 go(a)=1
if go(a)=1 g(a)=g(a)+1
if g(a)>2 g(a)=2
if g(a)=2 go(a)=0
if and(c,2^(a-1))=0 g(a)=0
next a

if go(5)=1 sel=sel-1
if go(7)=1 sel=sel+1
if sel<1 sel=1
if sel>10 sel=10

for a=1 to doilys
if sel=1 and doily=a then
if go(6)=1 points(a)=points(a)+1
if go(8)=1 points(a)=points(a)-1
endif
if points(a)<3 points(a)=3
if points(a)>40 points(a)=40
jump(a)=360/points(a)
next a

for a=1 to doilys
if sel=2 and doily=a then
if go(8)=1 span(a)=span(a)-1
if go(6)=1 span(a)=span(a)+1
endif
if span(a)<1 span(a)=1
if span(a)>int((points(a)-1)/2) span(a)=int((points(a)-1)/2)
next a

for a=1 to doilys
if sel=3 and doily=a then
if go(8)=1 r(a)=r(a)-10
if go(6)=1 r(a)=r(a)+10
endif
if r(a)<100 r(a)=100
if r(a)>220 r(a)=220
next a

for a=1 to doilys
if sel=4 and doily=a then
if go(8)=1 C(a)=C(a)-1
if go(6)=1 C(a)=C(a)+1
endif
if C(a)<1 C(a)=1
if C(a)>23 C(a)=23
for b=1 to col
if doily=a and C(a)=b text 570,80,C$(b)
next b
next a

if sel=5 then
if go(8)=1 D=D-1
if go(6)=1 D=D+1
endif
if D<1 D=1
if D>6 D=6

for a=1 to coh
if a=D text 570,100,D$(a)
next a

if sel=6 then
if go(8)=1 doily=doily-1
if go(6)=1 doily=doily+1
endif
if doily<1 doily=1
if doily>5 doily=5

if sel=7 and go(6)=1 then
for a=1 to doilys
r(a)=int(ran(150))+100
points(a)=int(ran(37))+3
span(a)=int(ran(15))
C(a)=int(ran(23))+1
m(a)=int(ran(2))
if m(a)=0 m(a)=-1
next a
endif

if sel=8 and go(6)=1 then
for a=1 to doilys
r(a)=a*30+70
points(a)=a*5+15
span(a)=5
C(a)=a
m(1)=1
m(2)=-1
m(3)=1
m(4)=-1
m(5)=1
next a
endif

for a=1 to doilys
if sel=9 and doily=a then
if go(8)=1 m(a)=-1
if go(6)=1 m(a)=1
endif
if m(a)=-1 and doily=a text 600,180,"<"
if m(a)=1 and doily=a text 600,180,">"
next a

for a=1 to doilys
if sel=10 and and(c,32)>0 dir(a)=dir(a)+m(a)
if dir(a)>359 dir(a)=0
if dir(a)<0 dir(a)=359
next a

for z=1 to doilys
for a=1 to points(z)
s=cos(ang*a*jump(z)+dir(z))*r(z)+x
t=sin(ang*a*jump(z)+dir(z))*r(z)+y
s1=cos(ang*(a-span(z))*jump(z)+dir(z))*r(z)+x
t1=sin(ang*(a-span(z))*jump(z)+dir(z))*r(z)+y

for b=1 to col
if C(z)=b setrgb 1,R(b),G(b),B(b)
next b

line s,t to s1,t1

next a
next z

for a=1 to heading
if sel=a then

for b=1 to coh
if D=b setrgb 1,R1(b),G1(b),B1(b)
next b

else
setrgb 1,256,256,256
endif
text 500,a*20,t$(a)
next a

setrgb 1,256,256,256

for a=1 to doilys
if doily=a then
text 570,20,str$(points(a))
text 570,40,str$(span(a))
text 570,60,str$(r(a))
endif
next a

text 570,120,str$(doily)

until (1=0)

label headings
data 10
data "points"
data "  span"
data "radius"
data "colour"
data "colour"
data "doily#"
data "random"
data " reset"
data "direction"
data "  turn"

label cols
data 23
data 256,256,256,"white"
data 256,000,000,"red"
data 000,256,000,"green"
data 000,000,256,"blue"
data 256,256,000,"yellow"
data 128,128,000,"olive"
data 256,128,000,"orange"
data 256,128,256,"purple"
data 256,128,128,"pink"
data 220,100,100,"roman"
data 150,075,000,"brown"
data 050,010,070,"violet"
data 080,110,200,"indigo"
data 256,200,160,"flesh"
data 256,190,000,"amber"
data 050,090,160,"azure"
data 128,128,256,"L.blue"
data 128,256,128,"L.green"
data 128,128,128,"grey"
data 192,192,192,"L.grey"
data 256,128,064,"L.brown"
data 200,120,040,"ochre"
data 210,180,140,"tan"

label colh
data 6
data 256,000,000,"red"
data 000,256,000,"green"
data 000,000,256,"blue"
data 256,256,000,"yellow"
data 256,128,000,"orange"
data 256,128,256,"purple"
Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.