I need my floor to keep moving without it stopping. at the moment it goes for 1 second but ends, i need that to keep repeating
public void act()
{
{
setLocation(getX() -8 , getY());
}
}
}public Game()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1, false);
prepare(); public Game()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1, false);
prepare();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
Floor floor = new Floor();
addObject(floor,337,207);
floor.setLocation(314,201);private void prepare()
{
Floor floor = new Floor();
int floorW = floor.getImage().getWidth();
int floorH = floor.getImage().getHeight();
addObject(floor, floorW/2, getHeight()-floorH/2);
floor = new Floor(); // create a second floor
addObject(floor, floorW+floorW/2, getHeight()-floorH/2);
}public void act()
{
move(-8);
if (getX() < -getImage().getWidth()/2) move(getImage().getWidth()*2);
}