public Boolean doesHit(Character target) { //check target's distance, check your attack range. see if intersects; if so return true return false; }
//Way you access CombatController //CombatController combat = CombatController.Instance; ////Then you could call the setMainCharacter function defined above //combat.setMainCharacter(player); public void confirmedHit(Character attacker, Character defender) { defender.takeDamage(damageFormula(attacker,defender)); }
public int damageFormula(Character attacker, Character target) { int damage=attacker.strength - target.defense; if (damage < 1) damage = 1; return damage; }
public static void hit(Character attacker, Character defender) { }