Added collision detection, gravity and friction