aUCBLogo Demos and Tests / walk
to walk
ht setUpdateGraph false
setPrintPrecision 5
skincolor=hsb 20 .3 .9
brown=hsb 0 .5 .3
red=hsb 0 1 1
darkred=hsb 0 1 .8
blue=hsb 240 1 1
darkblue=hsb 240 1 .8
nphi=100
t=timefine
forever
[ cs
x=250*repcount/nphi
a=abs sin 2*pi*repcount/nphi
(draw_walker repcount 3 x a)
pu setpos [0 -200] seth 90 setpc 0
label list "fps repcount/(timefine-t)
updateGraph
if key? [stop]
]
end
to draw_walker i [size 1][x 0][angle 1]
w=i*360/nphi
phi=80*angle*sin w
phi3=120*angle*sqr sin w/2
phi2=120*angle*sqr cos w/2
phiy=60*angle*sin 45+2*w
pu _setpos (list (37-phiy/20)*size (-18+phiy/10)*size) pd
draw_head
draw_hair
draw_nose
draw_eyes
draw_chin
draw_mouth
draw_neck
setpc darkred
draw_arm phi
armpos=pos
setheading 180
setpensize [15 15]*size
setpc red
fd 20*size
draw_feet
setheading 180
pu setpos armpos pd
setpc darkred
draw_arm -phi
end
to draw_head
setpc skincolor
setfc skincolor
fillcircle 7*size
end
to draw_hair
setpensize [8 8]*size
setHeading -140
setpc brown
arc 190 9*size
setHeading -140
arc 120 3*size
end
to draw_nose
setheading 100
setpc skincolor
setpensize [4 4]*size
pu fd 8*size pd fd 2*size pu back 10*size pd
end
to draw_eyes
setheading 90
setpc blue
setpensize [3 3]*size
pu fd 7*size pd fd 1*size pu back 8*size pd
end
to draw_chin
setheading 140
setpc skincolor
setpensize [9 9]*size
pu fd 5*size pd fd 2*size pu back 7*size pd
end
to draw_mouth
opos=pos
setheading 126
setpc red
setpensize [1.5 1.5]*size
pu fd 8*size left 20 pd fd 2*size
pu setpos opos pd
end
to draw_neck
setheading 180
setpensize [8 8]*size
setpc skincolor
pu fd 7*size pd
fd 8*size
end
to draw_arm phi
opos=pos
setpensize [8 8]*size
setheading 220-phi
fd 12*size
left 70+phi*0.7
fd 10*size
setpc skincolor
setpensize [6 6]*size
fd 4*size
pu setpos opos pd
end
to draw_feet
setpc darkblue
draw_foot phi phi2
setpc blue
draw_foot -phi phi3
end
to draw_foot phi phi2
opos=pos
setheading 180-phi
setpensize [12 12]*size
fd 15*size
right phi2
fd 13*size
setpensize [6 6]*size
fd 3*size
left 90
back 2*size
setpc brown
fd 11*size
pu setpos opos pd
end