Added code that handles gameovers and player deaths