I am using this to screen wrap my pbject but it seems to not be working. Here is the class for what i want to screen wrap.
int w=getWorld().getWidth(); int h=getWorld().getHeight() setLocation((getX()+w)%w, ((getY()+h)%h);
public class Apple extends Actor
{
private int numApples = 3;
/**
* Act - do whatever the Apple wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
remove();
move();
int w=getWorld().getWidth();
int h=getWorld().getHeight();
setLocation((getX()+w)%w, ((getY()+h)%h));
}
public void remove()
{
if (isTouching( Camel.class))
{
getWorld().removeObject(this);
}
if (isTouching (Shooter.class))
{
getWorld().removeObject(this);
}
}
public void move()
{
setLocation(getX()+Greenfoot.getRandomNumber(4)-2,getY() +Greenfoot.getRandomNumber(4)-2);
}
}