x1=maximum x - ball position x – ball radius
t=x1/velx
y1=t*vely
ball position x=previous ball position x + x1
ball position y=previous ball position y + y1
velx=-velx
ball position x=ball position x + (1-t)* velx
ball position y=ball position y + (1-t)* vely