x0=101;
y0=200;
v0x=0;
v0y=0;
pine=0.6;(*小さすぎるとめり込みやすくなる*)

medalr=6;

g=9.8;

screenwidth=200;
screenheight=200;
center=screenwidth/2;
wallwidth=30;
wallheight=screenheight+100;

pinsettingcenter={{center,50},{center,90},{center,140}};
pinsettingleft={{80,40},{60,70},{90,20},{45,10},{70,80},{45,110},{70,130},{60,170},{70,100},{50,50},{60,30},{70,5},{80,1}};
pincoord=Table[{(screenwidth-pinsettingleft[[i,1]]),pinsettingleft[[i,2]]},{i,1,Length[pinsettingleft],1}
];
pincoord=Join[pincoord,pinsettingleft,pinsettingcenter];
pinr=1;
pin=Table[{Black,Disk[pincoord[[i]],pinr]},{i,1,Length[pincoord],1}];

wallleft={LightGray,Rectangle[{0,0},{wallwidth,wallheight}]};
wallright={LightGray,Rectangle[{screenwidth-wallwidth,0},{screenwidth,wallheight}]};
walle=0.5;

distance=medalr+pinr;
collisiont=0;

fps=30;(*大きいほど精度が上がるが処理時間がかかる*)
dt=1/fps;
maxtime=30;(*[sec]*)
waittime=dt;

title="("<>ToString[x0]<>","<>ToString[y0]<>"),v0=("<>ToString[v0x]<>","<>ToString[v0y]<>"),e="<>ToString[pine]<>".gif";

getDistance[x_]:=EuclideanDistance[{medalx,medaly},pincoord[[x]]];
anime=Table[

medalx=x0+v0x (t-collisiont);
medaly=y0+v0y( t-collisiont)-1/2 g( t-collisiont)^2;

If[(t-collisiont)>waittime,
If[((medalx-medalr)≤wallwidth)||(medalx+medalr)≥((screenwidth-wallwidth)),
x0=medalx;
y0=medaly;
v0x*=-walle;
v0y=v0y-g (t-collisiont);
collisiont=t;
];
For[
i=1;,
i≤Length[pincoord],
i++,
If[(getDistance[i]≤distance),
x0=medalx;
y0=medaly;
v0y=v0y-g (t-collisiont);(*衝突直前の速度 x方向は等速なのでそのまま*)

theta=ArcSin[(medaly-pincoord[[i,2]])/getDistance[i]];
If[medalx<pincoord[[i,1]],
theta=2 Pi-theta;
];
vr=v0x Cos[theta]+v0y Sin[theta];
vtheta=-v0x Sin[theta]+v0y Cos[theta];
vr*=-pine;
v0x=vr Cos[theta]-vtheta Sin[theta];
v0y=vr Sin[theta]+vtheta Cos[theta];
collisiont=t;
Break[];
];
];
];

medal=Disk[{medalx,medaly},medalr];

Graphics[{{GrayLevel[.5],medal},pin,wallleft,wallright},{PlotRange->{{0,screenwidth},{0,screenheight}}
}
]
,{t,0,maxtime,dt}
];
ListAnimate[anime]
Export[title,anime]