hi i have a game where you have to click on a dice and when you have 66 points you win. i want to reset all counters when 66 points are achieved. but i have this problem: java.lang.ClassCastException: class player1 cannot be cast to class player2
code of the winner screen:
code of the method:
and the code to show the winner screen:
thanks
public void act()
{
((player1)getWorld()).lose();
((player2)getWorld()).lose1(); // here is the problem
}
public void lose(){
counter1.setValue(0);
counter2.setValue(0);
}
// and
public void lose1(){
counter1.setValue(0);
counter2.setValue(0);
}
if(counter1.getValue() >= 66){
removeObject(p2);
addObject(new p1wins(), 640, 360);
}