Added functions from game/ball.js to the engine