public void endGame(GameData gamedata) { if (!gamedata.getDeathscreenHit()) { Bundle finalInfo = new Bundle(); finalInfo.putInt(GameData.getScoreKey(), score); Intent intent = new Intent(GameData.leContext, DeathScreen.class); intent.putExtras(finalInfo); GameData.leContext.startActivity(intent); ((Activity) GameData.leContext).finish(); gamedata.setDeathscreenHit(true); } }
public void damage(GameData gamedata, int amount) { health -= amount; showDamage(); if (health <= 0) { gamedata.setPrevScore(score); endGame(gamedata); } }