I have three levels. I used this code for Lara and Iv'e managed to make her go to the next level but i cant make her move to the third.
public int counter = 0;
public void act()
{
if (canSee(Monuments.class))
{
eat(Monuments.class);
Greenfoot.playSound("slurp.wav");
counter++;
if(counter == 3 )
{
newLevel();
}
}
if (Greenfoot.isKeyDown("right"))
{
move (4);
}
if (Greenfoot.isKeyDown("left"))
{
move (-4);
}
if (canSee(Bomb.class))
{
eat(Bomb.class);
Greenfoot.playSound("au.wav");
}
}
public void newLevel()
{
World world;
world = getWorld();
Greenfoot.setWorld(new Asia());
}
public void newLeve2()
{
World world;
world = getWorld();
Greenfoot.setWorld(new Europe());
}
Hi please help me. How do i make Lara (person), go to a new level (world) with a different background and a different image for lara. This is her code as of now
public int counter = 0;
public void act()
{
if (canSee(Monuments.class))
{
eat(Monuments.class);
Greenfoot.playSound("slurp.wav");
counter++;
if(counter == 3 )
{
newLevel();
}
}
if (Greenfoot.isKeyDown("right"))
{
move (4);
}
if (Greenfoot.isKeyDown("left"))
{
move (-4);
}
if (canSee(Bomb.class))
{
eat(Bomb.class);
Greenfoot.playSound("au.wav");
}
}
public void newLevel()
{
World world;
world = getWorld();
int x = (int)(100+Math.random()*350);
int y = 80;
world.addObject(new Monuments(x,y) , x,y);
x = (int)(100+Math.random()*350);
world.addObject(new Monuments(x,y) , x,y);
x = (int)(100+Math.random()*350);
world.addObject(new Monuments(x,y) , x,y);
}
2014/2/12
Tara-Lara
2014/2/11
Tara-Lara
2014/2/11
Tara-Lara
2014/2/11
Tara-Lara