Every time i try and replace an object it always says that my object that I'm trying to show by replacing it isn't a variable.what do i do????it also has to replace when a key is pressed.how would i put that in code I'm coming from Alice so i know what to code i just don't know how to make the methods.
public void moveOnKeyPress()
{
if(Greenfoot.isKeyDown("left")) {
moveLeft();
}
if(Greenfoot.isKeyDown("right")) {
moveRight();
}
if(Greenfoot.isKeyDown("up")) {
moveUp();
}
if(Greenfoot.isKeyDown("down")) {
moveDown();
} if(Greenfoot.isKeyDown("F")) {
replace();
}
} public void replace()
{ Actor goku = getOneObjectAtOffset(0, 0, goku.class); if (goku != null) { getWorld().removeObject(goku);Actor gokucharge = getOneObjectAtOffset(0, 0, gokucharge.class);} }
}
