Dark Bit Factory & Gravity
PROGRAMMING => Other languages => Yabasic => Topic started by: bikemadness on June 20, 2026
-
This shows a preset segmented line controlled by repeating math.
joint=24
dim x(joint)
dim y(joint)
dim dir(joint)
dim arm(joint)
dim s(joint)
for a=1 to joint
dir(a)=0
arm(a)=15
next a
dir(1)=20
ang=pi/180
x=320
y=100
open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
dir(1)=dir(1)+m
if dir(1)<90 m=m+.05
if dir(1)>91 m=m-.05
for a=2 to joint
if dir(1)<90 dir(a)=dir(a)-.12
if dir(1)>90 dir(a)=dir(a)+.12
next a
for a=1 to joint
s(a)=0
next a
d=0
setrgb 1,256,256,256
for a=1 to joint
d=d+dir(a)
x(a)=cos(d*ang)*arm(a)
y(a)=sin(d*ang)*arm(a)
s(1)=s(1)+x(a-1)
s(2)=s(2)+y(a-1)
s(3)=s(3)+x(a)
s(4)=s(4)+y(a)
line s(1)+x,s(2)+y to s(3)+x,s(4)+y
next a
until (1=0)