REM Running man demo by Fryer
REM 
REM Press X to run on the spot
REM
REM Square to show skeleton

open window 640,512
setup()
repeat 
    setdispbuf ss
    ss=1-ss
    setdrawbuf ss
    clear window
    j1=peek("port1")
    for i=3 to 0 step-1
    ka=30*sn(rp)
    kx1=leg*sn(160+ka)
    ky1=-leg*cs(160+ka)
    kx2=leg*sn(160-ka)
    ky2=-leg*cs(160-ka)
    aa=80*sn(mod(rp+320,360))
    ax1=leg*sn(220+aa)
    ay1=-leg*cs(220+aa)
    ax2=leg*sn(220-aa)
    ay2=-leg*cs(220-aa)
    bx1=kx1/6-3
    bx2=kx2/6-3
    sx1=sho*sn(180-ka)*sn(ba+45)
    sy1=sho*sn(180-ka)*cs(ba+45)
    sx2=sho*sn(180+ka)*sn(ba+45)
    sy2=sho*sn(180+ka)*cs(ba+45)
    sx=back*sn(ba)
    sy=-back*cs(ba)
    wa=70*sn(mod(rp+30,360))
    ex1=arm*sn(180-ka)
    ey1=-arm*cs(180-ka)
    ex2=arm*sn(180+ka)
    ey2=-arm*cs(180+ka)
    wx1=arm*sn(90-wa)
    wy1=-arm*cs(90-wa)
    wx2=arm*sn(90+wa)
    wy2=-arm*cs(90+wa)
    na=30+10*sn(mod(90+rp*2,360))
    hx=neck*sn(na)
    hy=-neck*cs(na)
setrgb 1,140-i*30,80-i*30,80-i*30
tx=x+kx1:ty=y+ky1
fill triangle x+ky1/4,y-kx1/4 to x-ky1/4,y+kx1/4 to tx+ky1/5,ty-kx1/5
fill triangle tx+ky1/5,ty-kx1/5 to tx-ky1/5,ty+kx1/5 to x-ky1/4,y+kx1/4
fill circle tx,ty,leg/5
tx=tx+ax1:ty=ty+ay1
fill triangle x+kx1+ay1/5,y+ky1-ax1/5 to x+kx1-ay1/5,y+ky1+ax1/5 to tx+ay1/8,ty-ax1/8
fill triangle tx+ay1/8,ty-ax1/8 to tx-ay1/8,ty+ax1/8 to x+kx1-ay1/5,y+ky1+ax1/5
fy1=min(350,ty-ax1*.6)
fill triangle tx,ty to x+kx1+ax1*.7,y+ky1+ay1*.7 to tx+ay1*.6,fy1
fill circle x+bx1,y,leg/3.5
tx=x+sx+sx1:ty=y+sy+sy1
fill circle tx,ty,arm/3
fill triangle tx+ey1/3,ty-ex1/3 to tx-ey1/3,ty+ex1/3 to tx+ex1+ey1/4,ty+ey1-ex1/4
fill triangle tx-ey1/3,ty+ex1/3 to tx+ex1+ey1/4,ty+ey1-ex1/4 to tx+ex1-ey1/4,ty+ey1+ex1/4
tx=tx+ex1:ty=ty+ey1
fill circle tx,ty,arm/4
fill triangle tx+wy1/4,ty-wx1/4 to tx-wy1/4,ty+wx1/4 to tx+wx1+wy1/6,ty+wy1-wx1/6
fill triangle tx-wy1/4,ty+wx1/4 to tx+wx1-wy1/6,ty+wy1+wx1/6 to tx+wx1+wy1/6,ty+wy1-wx1/6
fill circle tx+wx1,ty+wy1,arm/4
setrgb 1,150-i*30,90-i*30,90-i*30
tx=x+sx:ty=y+sy
fill triangle tx-sy/4,ty+sx/4 to tx+sy/4,ty-sx/4 to tx+hx,ty+hy
fill triangle tx+sy/4,ty-sx/4 to tx+hx,ty+hy to tx+hx+hy/3,ty+hy-hx/3
fill circle tx+hx,ty+hy,neck/2
fill triangle x-sy/5,y+sx/5 to x+sy/5,y-sx/5 to tx-sy/4,ty+sx/4
fill triangle x+sy/5,y-sx/5 to tx-sy/4,ty+sx/4 to tx+sy/4,ty-sx/4
setrgb 1,160-i*30,100-i*30,100-i*30
tx=x+kx2:ty=y+ky2
fill triangle x+ky2/4,y-kx2/4 to x-ky2/4,y+kx2/4 to tx+ky2/5,ty-kx2/5
fill triangle tx+ky2/5,ty-kx2/5 to tx-ky2/5,ty+kx2/5 to x-ky2/4,y+kx2/4
fill circle tx,ty,leg/5
tx=tx+ax2:ty=ty+ay2
fill triangle x+kx2+ay2/5,y+ky2-ax2/5 to x+kx2-ay2/5,y+ky2+ax2/5 to tx+ay2/8,ty-ax2/8
fill triangle tx+ay2/8,ty-ax2/8 to tx-ay2/8,ty+ax2/8 to x+kx2-ay2/5,y+ky2+ax2/5
fy1=min(350,ty-ax2*.6)
fill triangle tx,ty to x+kx2+ax2*.7,y+ky2+ay2*.7 to tx+ay2*.6,fy1
fill circle x+bx2,y,leg/3.5
tx=x+sx+sx2:ty=y+sy+sy2
fill circle tx,ty,arm/3
fill triangle tx+ey2/3,ty-ex2/3 to tx-ey2/3,ty+ex2/3 to tx+ex2+ey2/4,ty+ey2-ex2/4
fill triangle tx-ey2/3,ty+ex2/3 to tx+ex2+ey2/4,ty+ey2-ex2/4 to tx+ex2-ey2/4,ty+ey2+ex2/4
fill circle x+sx+sx2+ex2,y+sy+sy2+ey2,arm/4
tx=tx+ex2:ty=ty+ey2
fill triangle tx+wy2/4,ty-wx2/4 to tx-wy2/4,ty+wx2/4 to tx+wx2+wy2/6,ty+wy2-wx2/6
fill triangle tx-wy2/4,ty+wx2/4 to tx+wx2-wy2/6,ty+wy2+wx2/6 to tx+wx2+wy2/6,ty+wy2-wx2/6
fill circle tx+wx2,ty+wy2,arm/4

if and(j1,32768)>0 then
setrgb 1,0,0,0
line x,y to x+kx1,y+ky1
line x,y to x+kx2,y+ky2
line x+kx1,y+ky1 to x+kx1+ax1,y+ky1+ay1
line x+kx2,y+ky2 to x+kx2+ax2,y+ky2+ay2
line x,y to x+sx,y+sy
line x+sx+sx1,y+sy+sy1 to x+sx+sx2,y+sy+sy2
line x+sx+sx1,y+sy+sy1 to x+sx+sx1+ex1,y+sy+sy1+ey1
line x+sx+sx2,y+sy+sy2 to x+sx+sx2+ex2,y+sy+sy2+ey2
line x+sx+sx1+ex1,y+sy+sy1+ey1 to x+sx+sx1+ex1+wx1,y+sy+sy1+ey1+wy1
line x+sx+sx2+ex2,y+sy+sy2+ey2 to x+sx+sx2+ex2+wx2,y+sy+sy2+ey2+wy2
line x+sx,y+sy to x+sx+hx,y+sy+hy
fi  
    rp=mod(rp+7,360)
    if and(j1,16384)=0 x=mod(x+100+leg/16,840)-100
    next i
    rp=mod(rp+341,360)
    ayp1=y+ky1+ay1
    ayp2=y+ky2+ay2
    my=max(ayp1,ayp2)
    if my>350 y=y-(my-350)
    if my<350 y=y+.6
until (and(j1,8)>0)
end
sub setup()
    ss=0
    dim sn(360),cs(360)
    for i=0 to 360
        sn(i)=sin(i/180*pi)
        cs(i)=cos(i/180*pi)
    next i
    rp=0
    x=-100:y=250
    leg=51
    arm=35
    back=50
    sho=20
    neck=32
    ba=20    
end sub









