Hello everyone, I have a little question regarding a project for my class. We are making a tower defense game with ants and zombies objects for our project. My question is with this piece of code provided to us.
/**
* Callback invoked when the player attempts to recruit an ant.
* @param antType Type of ant to recruit
* @return true if the player may recruit the ant, false if not.
*/
public boolean recruitAnt(String antType);
This is code from an interface file that was prvoided to us. I have no idea what "Callback invoked" means and how to turn String antType into the object of ant. So far I have an abstract base class Ant from which to create other ants.
package proj4;
public abstract class Ant {
private int life;
private String desc;
private int cost;
public Ant(int cost, int life, String desc){
this.life = life;
this.desc = desc;
this.cost = cost;
}
public void takeDamage(int amount, Zombie z){
life -= amount;
}
public void takeDamage(int amount){
life -= amount;
}
public int getLife() {
return life;
}
public String getDesc(){
return desc;
}
public int getCost(){
return cost;
}
public abstract void attack(Game g);
}
If anyone could give me pointers on what I'm supposed to do I would very much appreciate it. Thank you