added game ending logic and fixed game over screen