max_x and max_y changed to window.innerWidth and window.innerHeight to make it reponsive
ball implementation using class attempt