Refactoring code: added backgroundCollision method in Pacman class.