@Override public void collided(Sprite s1, Sprite s2) { s1.setActive(false); Integer lives = (Integer) ((BetterSprite) s2).getStat("lives").getStat(); lives -= LIVES_LOST; s2.setX(350); }
@Override public void collided(Sprite s1, Sprite s2) { damage = s1.getID(); health = s2.getID(); s2.setID(health - damage); s1.setID(damage - health); s1.setActive(false); if (health - damage < 1) { s2.setActive(false); game.setMoney(game.getMoney() + 10); } getGroup1().removeInactiveSprites(); getGroup2().removeInactiveSprites(); }
public void collided(Sprite player, Sprite enemy) { ((Player) player).reduceHealth(damage); enemy.setActive(false); }