Clear[t]
Clear[x]
Clear[y]
Clear[xm]
Clear[ym]
Clear[xb]
Clear[cy]
Clear[cx]


xb=200;

xm[t_]:=t/;t<200
xm[t_]:=200/;200<=t

dokx[t_]:=t-2420/;t<2925
dokx[t_]:=505/;2925≤t




ym[t_]:=0/;t<100
(*ym[t_]:=-(60/2500)*(t-50)^2+60/;t<100*)
ym[t_]:=-(60/2500)*(t-150)^2+60/;100<=t<178
ym[t_]:=45/;178<=t<332
ym[t_]:=-(45/2500)*(t-332)^2+45/;332<=t<382
ym[t_]:=0/;382<=t<410
ym[t_]:=-(60/2500)*(t-460)^2+60/;410<=t<488.8
ym[t_]:=40/;488.8<=t<500
ym[t_]:=-(100/2500)*(t-550)^2+100/;500<=t<577.3
ym[t_]:=70/;577.3<=t<630
ym[t_]:=-(70/2500)*(t-630)^2+70/;630<=t<680
ym[t_]:=0/;680<=t<800
ym[t_]:=-(60/2500)*(t-850)^2+60/;800<=t<900
ym[t_]:=0/;900<=t<1200
ym[t_]:=-(60/2500)*(t-1250)^2+60/;1200<=t<1300
ym[t_]:=0/;1300<=t<1720
ym[t_]:=-(60/2500)*(t-1770)^2+60/;1720<=t<1820
ym[t_]:=-(30/2500)*(t-1870)^2+30/;1820<=t<1920
ym[t_]:=0/;1920<=t<2090
ym[t_]:=-(60/3600)*(t-2150)^2+60/;2090<=t<2180
ym[t_]:=45/;2180<=t<2420
ym[t_]:=-(45/2500)*(t-2420)^2+45/;2420<=t<2470
ym[t_]:=0/;2470<=t<2750
ym[t_]:=-(60/2500)*(t-2800)^2+60/;2750<=t<2830
ym[t_]:=40/;2830<=t<2880
ym[t_]:=-(40/2500)*(t-2870)^2+40/;2870<=t<2920
ym[t_]:=0/;2920<=t<3000
ym[t_]:=-(60/6400)*(t-3080)^2+60/;3000<=t


xkr[t_]:=2580-0.85*t/;t<2925
xkr[t_]:=93.75/;2925<t

ykr[t_]:=0/;t<=1820
ykr[t_]:=-10/;1820<=t

yamax[t_]:=t-2800/;t<2925
yamax[t_]:=125/;2925<t

kumox[t_]:=t-2550/;t<2925
kumox[t_]:=375/;2925<t

x[t_]:=t/;t<1000
x[t_]:=1600/;1000<=t<1500
x[t_]:=t/;1500<=t
y[t_]:=0


cy[t_]:=0/;t<20
cy[t_]:=-30/3600(t-80)^2+30/;20<=t<80
cy[t_]:=1000/;30<=t

Bg[xbg_,ybg_]:=Graphics[{
RGBColor[0.32,0.5,1],Rectangle[{0,0},{300,200}]},PlotRange->{{0,300},{-20,200}}]

Bg2[xbg_,ybg_]:=Graphics[{
RGBColor[0.6,0.2,0],Rectangle[{0,-20},{300,0}]},PlotRange->{{0,300},{-20,200}}]



Tex[a_,b_]:=Graphics[{Text[Style["MARIO              　　　　　　　　　WORLD          TIME",Bold,White],{a,b}]}]

Tex2[a_,b_]:=Graphics[{Text[Style["     018000              　　　　 　　　　　  1-1                     ",Bold,White],{a,b}]}]

Tex3[a_,b_,t_]:=Graphics[{Text[Style[""t"",Bold,White],{a,b}],
RGBColor[0.32,0.5,1],Rectangle[{a,b},{a+8,b+6}]
}]

Tex4[a_,b_]:=Graphics[{Text[Style["x98",Bold,White],{a,b}]}]

TesTex[a_,b_]:=Graphics[{Text[Style["1up",Large,Bold,White],{a,b}]
}]
TesTex2[a_,b_,t_]:=Graphics[{Text[Style[""t"",Large,Bold,Black],{a,b}]
}]



Mario[xm_,ym_]:=Graphics[{
RGBColor[0,0.5,0],Rectangle[{-1+xm,0+ym},{2+xm,2+ym}],
Red,Rectangle[{2+xm,14+ym},{11+xm,15+ym}],
Red,Rectangle[{0+xm,1+ym},{5+xm,3+ym}],
Red,Rectangle[{9+xm,1+ym},{11+xm,4+ym}],
Red,Rectangle[{2+xm,2+ym},{9+xm,9+ym}],
Red,Rectangle[{3+xm,15+ym},{8+xm,16+ym}],
Orange,Rectangle[{-2+xm,5+ym},{1+xm,8+ym}],
Orange,Rectangle[{10+xm,6+ym},{13+xm,8+ym}],
RGBColor[0,0.5,0],Rectangle[{1+xm,10+ym},{11+xm,13+ym}],RGBColor[0,0.5,0],Rectangle[{2+xm,11+ym},{9+xm,14+ym}],RGBColor[0,0.5,0],Rectangle[{11+xm,1+ym},{13+xm,4+ym}],
RGBColor[0,0.5,0],Rectangle[{0+xm,7+ym},{4+xm,9+ym}],
RGBColor[0,0.5,0],Rectangle[{2+xm,6+ym},{4+xm,9+ym}],
RGBColor[0,0.5,0],Rectangle[{8+xm,8+ym},{10+xm,9+ym}],
RGBColor[0,0.5,0],Rectangle[{9+xm,7+ym},{12+xm,8+ym}],
RGBColor[0,0.5,0],Rectangle[{9+xm,6+ym},{10+xm,7+ym}],Orange,Rectangle[{5+xm,5+ym},{6+xm,6+ym}],
Orange,Rectangle[{5+xm,9+ym},{7+xm,14+ym}],
Orange,Rectangle[{3+xm,9+ym},{9+xm,10+ym}],
Orange,Rectangle[{3+xm,10+ym},{7+xm,11+ym}],
Orange,Rectangle[{8+xm,12+ym},{9+xm,14+ym}],
Orange,Rectangle[{7+xm,11+ym},{8+xm,12+ym}],
Orange,Rectangle[{9+xm,11+ym},{11+xm,13+ym}],
Orange,Rectangle[{2+xm,11+ym},{3+xm,13+ym}]},PlotRange->{{0,30},{0,200}}]

Bro[x_,y_]:=Graphics[{
Black,Rectangle[{15+(xb-x),35+y},{25+(xb-x),45+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{15+(xb-x),35.5+y},{20+(xb-x),37.5+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{20.5+(xb-x),35.5+y},{25+(xb-x),37.5+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{15+(xb-x),37.75+y},{17+(xb-x),40+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{17.25+(xb-x),37.75+y},{25+(xb-x),40+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{15+(xb-x),40.25+y},{20+(xb-x),42.5+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{20.5+(xb-x),40.25+y},{25+(xb-x),42.5+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{15+(xb-x),42.75+y},{17+(xb-x),45+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{17.25+(xb-x),42.75+y},{23+(xb-x),45+y}],
RGBColor[0.7,0.25,0.1],Rectangle[{23.25+(xb-x),42.75+y},{25+(xb-x),45+y}]},PlotRange->{{0,300},{0,200}}]

Dokan[x_,yd_]:=Graphics[{
Black,Rectangle[{100+(xb-x/2),0+yd},{130+(xb-x/2),50+yd}],
Black,Rectangle[{98+(xb-x/2),50+yd},{132+(xb-x/2),70+yd}],
RGBColor[0,0.9,0],Rectangle[{101+(xb-x/2),0+yd},{129+(xb-x/2),50+yd}],
RGBColor[0,0.9,0],Rectangle[{99+(xb-x/2),51+yd},{131+(xb-x/2),69+yd}],
RGBColor[0,0.75,0],Rectangle[{105+(xb-x/2),0+yd},{110+(xb-x/2),50+yd}],
RGBColor[0,0.75,0],Rectangle[{116+(xb-x/2),0+yd},{126+(xb-x/2),50+yd}],
RGBColor[0,0.75,0],Rectangle[{103+(xb-x/2),51+yd},{107+(xb-x/2),69+yd}],
RGBColor[0,0.75,0],Rectangle[{114+(xb-x/2),51+yd},{124+(xb-x/2),69+yd}]
},PlotRange->{{0,300},{0,200}}]

Ana[x_,y_]:=Graphics[{
RGBColor[0.32,0.5,1],Rectangle[{100+(xb-x/2),-20+y},{130+(xb-x/2),0+y}]
},PlotRange->{{0,300},{0,200}}]

Coins[x_,cy_]:=Graphics[{Black,Disk[{xb+1-x/2,20+cy},{3,4}],
RGBColor[1,0.6,0.1],Disk[{xb-x/2,20+cy},{3,4}],
Black,Disk[{xb+0.1-x/2,20+cy},{1.5,2.3}],
RGBColor[1,0.6,0.1],Disk[{xb-x/2,20+cy},{1.2,2}]
},
PlotRange->{{0,300},{0,200}}]

Kumo[x_,y_]:=Graphics[{
White,Disk[{xb-x/2,150+y},{10,10}],
White,Disk[{xb-x/2,135+y},{10,10}],
White,Disk[{xb-x/2-10,142.5+y},{10,10}],
White,Disk[{xb-x/2+10,150+y},{10,10}],
White,Disk[{xb-x/2+10,135+y},{10,10}],
White,Disk[{xb-x/2+20,142.5+y},{10,10}]
},
PlotRange->{{0,300},{0,200}}]

Yama[x_,y_]:=Graphics[{
RGBColor[0,0.5,0],Disk[{xb-x/2,10+y},{10,10}],
Polygon[{{xb-x/2-25,0+y},{xb-x/2,0},{xb-x/2-9.5,15.5+y}}],
Polygon[{{xb-x/2+25,0+y},{xb-x/2,0},{xb-x/2+8.5,15.5+y}}]
},
PlotRange->{{0,300},{0,200}}]

Kuribo[xm_,ym_]:=Graphics[{
Black,Rectangle[{20+xm,0+ym},{24+xm,3+ym}],
Black,Rectangle[{27+xm,0+ym},{32+xm,5+ym}],
Orange,Rectangle[{18+xm,6+ym},{32+xm,13+ym}],
Orange,Rectangle[{19+xm,6+ym},{31+xm,14+ym}],
Orange,Rectangle[{21+xm,6+ym},{30+xm,15+ym}],
Orange,Rectangle[{22+xm,6+ym},{28+xm,16+ym}],
Orange,Rectangle[{23+xm,6+ym},{27+xm,17+ym}],
Orange,Rectangle[{17+xm,7+ym},{33+xm,12+ym}],
Orange,Rectangle[{22+xm,6+ym},{28+xm,16+ym}],
Orange,Rectangle[{23+xm,6+ym},{27+xm,17+ym}],
Black,Rectangle[{21+xm,1+ym},{24+xm,3+ym}],
RGBColor[1,0.8,0.5],Rectangle[{21+xm,1+ym},{29+xm,6+ym}],
RGBColor[1,0.8,0.5],Rectangle[{22+xm,6+ym},{28+xm,7+ym}],
RGBColor[1,0.8,0.5],Rectangle[{21+xm,13+ym},{23+xm,9+ym}],
RGBColor[1,0.8,0.5],Rectangle[{23+xm,12+ym},{24+xm,9+ym}],
RGBColor[1,0.8,0.5],Rectangle[{26+xm,12+ym},{27+xm,9+ym}],
RGBColor[1,0.8,0.5],Rectangle[{27+xm,13+ym},{29+xm,9+ym}],
Black,Rectangle[{21+xm,1+ym},{22+xm,3+ym}],
Black,Rectangle[{20+xm,13+ym},{22+xm,14+ym}],
Black,Rectangle[{22+xm,13+ym},{23+xm,10+ym}],
Black,Rectangle[{23+xm,12+ym},{28+xm,11+ym}],
Black,Rectangle[{27+xm,10+ym},{28+xm,13+ym}],
Black,Rectangle[{28+xm,13+ym},{30+xm,14+ym}]
},
PlotRange->{{0,300},{0,200}}]


Animate[Show[{
Bg[xbg,ybg],
Yama[t,0],Yama[t-1200,0],Yama[t-2200,0],Yama[yamax[t]+300,0],Yama[t-1600,0],Yama[t-2400,0],Yama[yamax[t],0],



Kumo[t,0],Kumo[t+150,20],Kumo[t-1600,10],Kumo[t-1150,20],Kumo[t-2000,20],Kumo[t-2150,20],Kumo[t,3000],
Kumo[t,0],Kumo[t+150,20],Kumo[t-1200,10],Kumo[t-1550,20],Kumo[t-2200,20],Kumo[kumox[t],20],Kumo[kumox[t]-400,-10],

Kuribo[800-0.85*t,0],Kuribo[1600-0.85*t,0],Kuribo[1630-0.85*t,ykr[t]],

Kuribo[xkr[t],0],

(*TesTex[80,100],*)
Tex[150,180],
Tex2[145,170],
Tex4[130,170],
(*TesTex2[100,120,ym[t]],*)Tex3[255,170,70-IntegerPart[t/137.1428]],

Coins[170,150],


Dokan[t-100,-30],
Dokan[t-180,0],
Dokan[dokx[t],-30],

Bro[t/2-40,y[t]/2],
Bro[t/2-30,y[t]/2],Bro[t/2-20,y[t]/2],Bro[t/2-10,y[t]/2],
Bro[t/2,y[t]/2],Bro[t/2+10,y[t]/2],Bro[t/2+20,y[t]/2],Bro[t/2+30,y[t]/2],Bro[t/2+40,y[t]/2],
Bro[t/2-1090,y[t]/2],Bro[t/2-1080,y[t]/2],Bro[t/2-1070,y[t]/2],Bro[t/2-1060,y[t]/2],Bro[t/2-1050,y[t]/2],Bro[t/2-1040,y[t]/2],Bro[t/2-1030,y[t]/2],Bro[t/2-1020,y[t]/2],
Bro[t/2-1010,y[t]/2],Bro[t/2-1000,y[t]/2],Bro[t/2-990,y[t]/2],Bro[t/2-980,y[t]/2],Bro[t/2-970,y[t]/2],


Coins[t-60,cy[t-210]+40],Coins[t-40,cy[t-190]+40],Coins[t-20,cy[t-170]+40],

Coins[t-2200,cy[t-2340-15]+40],Coins[t-2180,cy[t-2320-15]+40],Coins[t-2160,cy[t-2300-15]+40],Coins[t-2140,cy[t-2280-15]+40],Coins[t-2120,cy[t-2260-15]+40],Coins[t-2100,cy[t-2240-15]+40],Coins[t-2080,cy[t-2220-15]+40],
Coins[t-2060,cy[t-2200-15]+40],Coins[t-2040,cy[t-2180-15]+40],Coins[t-2020,cy[t-2160-15]+40],


Bg2[10,10],
Ana[t-840,0],
Mario[xm[t]/2,ym[t]]
}
],

{t,-100,3500},DefaultDuration->30]

Needs["NETLink`"]
InstallNET[];
NETTypeInfo["System.IO.Ports.SerialPort"]
ser=NETNew["System.IO.Ports.SerialPort","COM8",9600]
ser@Open[]


ser@Write["A"]
Button["Stop",ser@Close[]]