Can someone explain why the class Rod is unable to add the object fishingBar into the World?
public class Rod extends Actor
{
private int pity = 0;
private final int hard = 15;
private final int soft = 8;
private boolean isCast = false, pressSpace = false, caught = false;
private String curType;
private World curWorld = getWorld();
private int dL = 3, dE = 2, dR = 1, dC = 1;
public void displayBar(){
Object sprite = curWorld.getObjects(cat.class);
((map)curWorld).addObject(new fishingBar(), 200, 200);
Greenfoot.delay(5);
}
public void act()
{
// Add your action code here.
if(isCast == false && pressSpace == false && Greenfoot.isKeyDown("c")){
pressSpace = true;
displayBar();
Greenfoot.delay(5);
}
pressSpace = false;
isCast = false;
}
}
