Delo delo =(Delo)getWorld().getObjects(Delo.class).get(0);
public void getPosdelo()
{
int x = delo.getX();
int y = delo.getY();
System.out.println("x+y");
}
What did I do wrong?
Well, the first line is not within the method. This means it will execute only once, when the object is created. However, it will not yet be in any world and you should get a 'nullPointerException' when creating the actor. Now, as long as you ALWAYS have a Delo object in the world, and the 'getPosdelo' method is called from the 'act' method or a method called by the 'act' method, it should work as the first line within the 'getPosdelo' method.