Say i have a actor, Play, int the world and i want to have some code in the world that removes this object - i can understand (this) but am not sure about this. Thanks
public void kill() { Actor actor = (Actor) getOneObjectAtOffset(0, 0, Actor.class); if(onActor()) { getWorld().removeObject(actor); } }
Actor something = new Something(); //that will create the object that you want to get rid of getWorld().removeObject(something);
getWorld().removeObject(theActor);
removeObject(theActor);
removeObjects(getObjects(Play.class));
removeObject(Play);
public Player player = new Player();
Player player = (Player) (getObjects(Player.class).get(0));
Counter counter = new Counter(); Scoreboard scoreboard = new Scoreboard(counter);
import greenfoot.*; public class Scoreboard extends Actor { Counter counter = null; public Scoreboard(Counter countr) { counter = countr; updateImage(); } // etc.