Guys, i have an error when changing world from FarmWorld to GoldWorld the error was like this.
what happened :(( because I think because this code
I use the move method for FarmWorld so when changing world it will send an error. The actor must have 1 gold/walk when on the FarmWorld and 2gold/walk when on the GoldWorld so I made a counter walk for that (But only at FarmWorld First because I have no idea for the gold world). Can you help me guyss :(( It's really meaningfull from me thankss
java.lang.ClassCastException: GoldWorld cannot be cast to FarmWorld at Petani.moveUp(Petani.java:79) at Petani.checkKey(Petani.java:45) at Petani.act(Petani.java:35)
public void moveDown(){
FarmWorld farmWorld = (FarmWorld)getWorld();
Counter counter = farmWorld.getCounter();
this.setLocation(getX(), getY()+speed);
if(animationCounter % 12 == 0){
animatedBawah();
counter.walkCount(1);
}
}


