Last update with fubarpk contribution .
// Project: Line Animation
// Created: 2020-03-29
// show all errors
SetErrorMode(2)
white=MakeColor(255,255,255)
// set window properties
SetWindowTitle( "Line Animation" )
SetWindowSize( 800, 600, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 800, 600 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
height=GetWindowHeight ()
width=GetWindowWidth ()
hh#=height/10
h#=hh#
global w
dim px[15]
dim py[15]
for i= 1 to 15
px[i]=-73+i*73
py[i]=100+random(0,80)
next
for k= 1 to 70
w=makecolor(190-k,170-k,0)
for i= 1 to 14
drawline(px[i],30+py[i]+k,px[i+1],30+py[i+1]+k,w,w)
next
next
getimage(1,0,0,1024,200)
createsprite(1,1)
setspritevisible(1,0)
b as float
do
run=run+1 `background blue)))))))))))))))))))))))))))))))))))))))
if run>1
w(100,100,255)
box(0,0,800,600)
endif
if run>30 `background brown)))))))))))))))))))))))))))))))))))))))
w(170,135,0)
box(0,200,800,600)
endif
`head
if run>60
w(130,100,0)
circle(400,350,160,170)
circle(400,300,150,210)
endif
`left ear
if run>90
w(242,154,138)
circle(240,240,30,40)
w(170,135,0)
circle(200,240,25,35)
endif
`right ear
if run>120
w(242,154,138)
circle(550,240,30,40)
w(170,135,0)
circle(590,240,25,35)
endif
`hat
if run>150
w(0,0,0)
circle(400,100,95,55)
w(100,100,255)
box(300,0,500,95)
w(0,0,0)
circle(400,95,70,50)
w(130,100,0)
box(315,130,488,275)
endif
`nose
if run>180
w(250,175,0)
circle(400,300,30,30)
circle(380,300,20,20)
circle(420,300,20,20)
circle(400,280,20,20)
circle(400,265,13,13)
endif
`eyes
if run>210
w(0,0,0)
circle(365,200,40,40)
circle(435,200,40,40)
w(130,100,0)
circle(365,210,35,35)
circle(435,210,35,35)
box(316,194,488,228)
w(255,255,255)
circle(365,210,40,40)
circle(435,210,40,40)
w(130,100,0)
circle(365,190,33,21)
circle(435,190,33,21)
w(255,255,255)
box(329,189,469,211)
w(0,0,0)
circle(360,212,10,10)
circle(452,208,10,10)
endif
`mouth
if run>240
w(200,0,0)
circle(400,350,80,80)
w(130,100,0)
circle(410,330,80,80)
`nose again
w(250,175,0)
circle(400,300,30,30)
circle(380,300,20,20)
circle(420,300,20,20)
circle(400,280,20,20)
circle(400,265,13,13)
endif
`moustache
if run>270
w(0,0,0)
endif
`animation of moustache
if run=275 then circle(352,332,10,23)
if run=280 then circle(364,335,10,20)
if run=285 then circle(378,343,10,20)
if run=290 then circle(390,350,10,20)
if run=295 then circle(405,350,10,20)
if run=300 then circle(420,345,10,20)
if run=305 then circle(435,339,10,20)
if run=310 then circle(450,335,10,23)
`moustache end
if run>320
circle(352,332,10,23)
circle(364,335,10,20)
circle(378,343,10,20)
circle(390,350,10,20)
circle(405,350,10,20)
circle(420,345,10,20)
circle(435,339,10,20)
circle(450,335,10,23)
endif
`hands
if run>340
w(200,200,200)
circle(250,315,10,30)
circle(551,315,10,30)
box(130,295,250,335)
box(551,295,670,335)
box(130,240,165,295)
box(650,295,690,400)
circle(147,241,25,25)
circle(135,230,10,35)
circle(125,235,14,10)
circle(670,400,25,25)
circle(647,397,10,15)
endif
`foot
if run>355
w(200,200,200)
circle(367,505,22,10)
circle(430,505,22,10)
box(350,505,380,570)
box(410,505,445,570)
endif
`shoes
if run>385
w(0,166,200)
circle(340,568,50,40)
circle(446,568,50,40)
w(0,150,190)
circle(340,568,40,35)
circle(446,568,40,35)
w(0,166,200)
circle(340,568,30,30)
circle(446,568,30,30)
w(0,166,200)
box(298,549,382,600)
box(404,549,486,600)
w(170,135,0)
box(279,580,510,600)
endif
`eye animation
s#=s#+0.5
if s#>8 then s#=-18
if run>450
w(255,255,255)
circle(360,212,10,10)
circle(452,208,10,10)
w(0,0,0)
circle(360+s#,212+b,10,10)
circle(452+s#,208+b,10,10)
endif
`final animation
if run>430
w(130,100,0)
box(304,370,491,436)
box(306,301,340,375)
endif
if run>430
w(100,0,0)
circle(396,392,18,11)
w(255,255,255)
circle( 396,390,16,2 )
endif
if run>450
w(100,100,255)
box(11,174,153,199)
w(170,135,0)
box(100,200,174,294)
w(200,200,200)
box(130,296,162,386)
circle(143,398,25,25)
circle(163,400,10,15)
endif
if run>550
box(130,240,165,295)
w(170,135,0)
box(96,336,181,426)
w(200,200,200)
circle(147,241,25,25)
circle(135,225,10,35)
circle(125,235,14,10)
endif
if run>600
`sky
w=makecolor(150,150,255)
drawbox(0,0,1024,200,w,w,w,w,1)
`mountains
Render2DFront()
setspritevisible(1,1)
`floor
w=makecolor(200,200,70)
drawbox(0,200,1400,800,w,w,w,w,1)
`Animation -------------------------------------
r=r+1
if r<35 then b=b+2
if r>35 then b=b-2
if r>70
r=0
b=0
ang=0
endif
x#=cos(ang)*25
y#=sin(ang)*15
ang=ang+5
`-----------------------------------------------
`left hand
w=makecolor(160,140,90)
line(440-x#/3,190,480-b,290,18)
`left leg
w=makecolor(0,100,0)
line(400,300,410+b,400,20)
line(430,300,410+b,400,20) `making thigh thicker
line(410+b,400,390+b*1.3,500-y#,20)
w=makecolor(100,90,20)
line(390+b*1.3,500-y#,420+b*1.3,500-y#,23)
`right leg
w=makecolor(0,120,0)
line(400,300,460-b,400,20)
line(440,300,460-b,400,20) `making thigh thicker
line(460-b,400,460-b*1.3,500+y#,20)
w=makecolor(120,100,30)
line(460-b*1.3,500+y#,490-b*1.3,500+y#,25)
w=makecolor(0,120,0)
drawellipse(415,300,40,40,w,w,1)
`body
w=makecolor(80,75,45)
line(420,280,430-x#/3,200,40)
w=makecolor(0,120,0)
drawbox(379,280,459,310,w,w,w,w,1) `mask
drawbox(385,295,450,320,w,w,w,w,1) `mask
w=makecolor(120,125,50)
line(382,290,452,290,8) `belt
w=makecolor(0,120,0)
drawbox(420,280,430,320,w,w,w,w,1)
`head
w=makecolor(170,150,100)
drawellipse(450-x#/3,130,50,50,w,w,1)
w=makecolor(180,150,100)
drawellipse(501-x#/3,135,10,10,w,w,1) `nose
w=makecolor(165,135,75)
drawellipse(450-x#/3,135,10,20,w,w,1) `ear
w=makecolor(170,150,100)
drawellipse(455-x#/3,135,10,10,w,w,1) `ear
w=makecolor(255,255,255)
drawellipse(490-x#/3,120,5,8,w,w,1) `eye
line(490-x#/3,153,510-x#/3,165,2) `cigar
w=makecolor(0,0,0)
line(490-x#/3,145,500-x#/3,150,5) `moustache
drawellipse(491-x#/3,120,3,4,w,w,1)
`right hand
w=makecolor(170,150,100)
line(430-x#/3,200,410+b,300,20)
w=makecolor(150,140,50)
line(415+b,305,420+b*1.2,540,5) `walking stick
`hat
w=makecolor(10,10,10)
line(400-x#/3,100,500-x#/3,100,15)
line(440-x#/3,80,460-x#/3,80,25)
`Venetian blind (((((((((( ADDED BY FUBARPK )))))))))))))))))))))
for t# = height to 0 step -hh#
DrawBox(0,t#,width,t#+h#,white,white,white,white,1)
next t#
if h# > 0
dec h#
else
//h#=hh#
endif
endif
`reseting Venetian blind (((((((((( ADDED BY FUBARPK )))))))))))))))))))))
if run=799
hh#=height/10
h#=hh#
endif
if run>800
w=makecolor(100,100,255)
drawbox(0,0,1370,768,w,w,w,w,1)
w=makecolor(0,180,0)
drawbox(0,200,1370,768,w,w,w,w,1)
w=makecolor(0,0,0)
circle(100,100,40,40)
circle(130,50,40,40)
circle(150,90,40,40)
circle(160,110,40,40)
circle(110,80,40,40)
line(130,120,130,250,10)
w(100,90,20)
line(130,120,130,250,8)
w(0,255,0)
circle(100,100,38,38)
circle(130,50,38,38)
circle(150,90,38,38)
circle(160,110,38,38)
circle(110,80,38,38)
`----
w=makecolor(0,0,0)
circle(500,100,40,40)
circle(530,50,40,40)
circle(550,90,40,40)
circle(560,110,40,40)
circle(510,80,40,40)
line(530,120,530,250,10)
w(100,90,20)
line(530,120,530,250,8)
w(0,255,0)
circle(500,100,38,38)
circle(530,50,38,38)
circle(550,90,38,38)
circle(560,110,38,38)
circle(510,80,38,38)
`reseting Venetian blind (((((((((( ADDED BY FUBARPK )))))))))))))))))))))
for t# = height to 0 step -hh#
DrawBox(0,t#,width,t#+h#,white,white,white,white,1)
next t#
if h# > 0
dec h#
else
//h#=hh#
endif
w(0,0,0)
circle(400,300,63,83)
w(200,180,60)
circle(400,300,60,80)
w(0,0,0)
circle(375,260,13,13)
circle(425,260,13,13)
w(255,255,255)
circle(375,260,11,11)
circle(425,260,11,11)
w(0,0,0)
circle(375,260,5,3)
circle(425,260,5,3)
circle(400,320,25,15)
w(200,180,60)
circle(400,310,25,20)
endif
sync()
loop
function line(x#,z#,x2#,z2#,s)
angle#= atanfull(x#-x2#, z#-z2#)+90
dx#=x#-x2#
dz#=z#-z2#
dist#=sqrt((dx#*dx#)+(dz#*dz#))
for i= 1 to dist#
x#=x#+cos(angle#)
z#=z#+sin(angle#)
drawellipse(x#,z#,s,s,w,w,1)
next
endfunction
function w(a,b,c)
w=makecolor(a,b,c)
endfunction
function box(a,b,c,d)
drawbox(a,b,c,d,w,w,w,w,1)
endfunction
function circle(a,b,c,d)
DrawEllipse(a,b,c,d,w,w,1)
endfunction
Cheers.
I'm not a grumpy grandpa