This site requires JavaScript, please enable it in your browser!
Greenfoot back
GreenGoo
GreenGoo wrote ...

2013/3/12

Upgrade screen between rounds

GreenGoo GreenGoo

2013/3/12

#
I am making a zombie game and I want to add screens with between each round. How do I do this?
danpost danpost

2013/3/12

#
Since each world will know which world to proceed to next (after the between screen is shown), you would want to create the new game world before calling the between screen world; pass it to the between screen world so it can go to that world when the between screen is done showing. If you had, let us say, 'Level1' and 'Level2' as game worlds and 'Intermission' as the between world, then:
// in the Level1 world, when complete (done similar for each level)
World world = new Level2();
Greenfoot.setWorld(new Intermission(world));

// in the Intermission class code
// add the following field
private World nextWorld;
// use this as your constructor
public Intermission(World world)
{
    super(600, 400, 1);
    nextWorld = world;
    // code to construct world
}
// to proceed to next world
Greenfoot.setWorld(nextWorld);
You can use the same technique to reset the current level from each level, if desired.
You need to login to post a reply.