I get this error after selecting single player.
The code that i have now is
java.lang.ClassCastException: java.util.ArrayList cannot be cast to greenfoot.Actor at Paddle.act(Paddle.java:65) at greenfoot.core.Simulation.actActor(Simulation.java:568) at greenfoot.core.Simulation.runOneLoop(Simulation.java:526) at greenfoot.core.Simulation.runContent(Simulation.java:215) at greenfoot.core.Simulation.run(Simulation.java:205)
if(Table.singlePlayer == true && returnPlayer() == 2) {
if (!getWorld().getObjects(Ball.class).isEmpty())
{
// is ball in world
if (!getWorld().getObjects(Ball.class).isEmpty())
{
// get reference to ball
Actor ball = (Actor)getWorld().getObjects(Ball.class);
// is ball on the half of the playfield this paddle is on
if (Math.abs(ball.getX()-getX()) < 335)
{
// get vertical direction to move (dy = { -1, 0, 1 })
int dy = (int)Math.signum((ball.getY()-getY())/3);
// make move in direction determined (or remain in place)
setLocation(getX(), getY()+5*dy);
}
}
}
}

