I made this:
DynamicModule[{pne = {0, 0}, ido = 0, a = {0, -0.40}, pr = 200,
dt = 0.1, pn = {0, 0}, vne = {0, 0}, vn, stop = 11},
ClickPane[
Framed @
Graphics[{
Orange, Dynamic @ Disk[pne, 4],
Green, Dynamic @ Arrow[{pne, (pne + vne)*1.5}]},
PlotRange -> pr],
With[{w = 1/5*(pne - MousePosition["Graphics"])},
ido = 0;
While[stop > 10,
ido = ido + 1;
vne = If[ido < 2, w + a*dt, vn + a*dt];
pne = If[ido < 2, pne + w*dt, pn + vne*dt];
If[pne[[2]] < -195, vne = (vne - Normalize[vne]/2)*{1, -1}];
If[pne[[2]] > 195, vne = (vne - Normalize[vne]/2)*{1, -1}];
If[pne[[1]] < -195, vne = (vne - Normalize[vne]/2)*{-1, 1}];
If[pne[[1]] > 195, vne = (vne - Normalize[vne]/2)*{-1, 1}];
vn = vne;
pn = pne;
stop = 1/2 Norm[vne]^2 + (pne[[2]] + 195)*0.4;
Pause[.001]; FinishDynamic[]]] &]]
I've noticed, the While
stops running after around 450 loops.
I can't figure it out what's the cause. Any help would be nice because I'm a beginner.