Added a condition to exit game

Signed-off-by: CoralBreding