To do this I have two actor classes, one of the classes has the normal image and the other has a mirror image of the first class.
This is the code i have decided to use;
public void move()
{
Actor Right = getOneObjectAtOffset(0,0, CharacterLeft.class);
if(Greenfoot.isKeyDown("right"))
{
setLocation(getX() + SPEED , getY());
}
if(Greenfoot.isKeyDown("left"))
{
setLocation(getX() - SPEED, getY());
Left L = new Left();
getWorld().addObject(L, getX(), getY());
getWorld().removeObjects(getWorld().getObjects(Right.class));
}
}
However i continuolsy get this error;
"java.lang.IllegalStateException: Actor not in world. An attempt was made to use the actor's location while it is not in the world. Either it has not yet been inserted, or it has been removed."
Any Suggestions
Thanks
