refactored code in object oriented way

added ball.js, init.js, constants.js and utils.js